The dark side of the hard drive clone I performed last night (the bright side is here
I always thought it was mighty stupid how the Linux kernel depends on the root=
parameter in the LILO/Grub config files to be exactly right to complete its boot. There is just something mind boggling when you start booting, and everything works, and then when it tries to mount the drive, if the root=
is not correct, it panics that it cannot find the drive and halts. I mean, the drive is right there! You just booted from it - why do I have to tell you again where it is?!
Well, XP is even worse.
You would think that after cloning the drive, you can just disconnect the original, connect the cloned in its place and it will work? No way. Windows assigns DOS drive letters not based on the physical connection of the drive, but based on the drive itself. It remembers drives it's seen, and keeps drive letters the same even if you connect them to different ports inside the system, unless you tell it to change the drive letter.
This does make sense to an extent (for example if you were forced to move to a different SATA/IDE port, you would have less problems). However here it meant that my OS became completely unusable. Once I told the PC to boot from the new drive, Windows booted just fine, but then when one comes to login, it tries to run the Userinit.exe from drive C:, but the new drive has been assigned a different letter! So it got stuck in a permanent logon/logoff loop, and since I could not login, I could not change the drive letter assignment!
So far it seems just like Linux, so why is it worse?
Because in Linux at least one can append a root=
parameter during boot to get the system up at which point one can edit the config files. How the heck do you do that in Windows? It's not an issue with the boot record, so FIXBOOT/FIXMBR/BCDEDIT won't help - the OS sees "itself" and boots just fine. The drive letter is something embedded in the registry!
1) Find where
in the registry the drive letter assignments take place (this took some googling - answer is HKLM\System\MountedDevices)
2) Boot up from the old drive with the new drive connected to a different port
3) Load the registry editor
4) From inside the registry editor, load the HKLM\System hive from the new drive (this is a neat feature I didn't know the built-in registry editor had)
5) Change the drive letter assignment so that the new drive is recognized in its own registry hive as C:, and unload the hive)
6) Turn PC off, disconnect the old drive and boot from the new drive. Finally!
Now, noticed how I rant about XP here. This is because somehow when I did the same procedure on a PC running Vista, it did somehow allow me to login and change the drive letters manually. So I am not sure whether they made the new kernels smarter or whether I did some things differently.
But at least it works now.