Sunday, February 21, 2010

Recovering From A Changed Drive Letter

In previous WinNT operating systems you can have problems with clones or images when they do not correctly see themselves as the same drive letter as the parent install. This usually results in major issues and even cross-linked installs where files from both the parent and the clone will be used during bootup. The main cause of trouble is the way WinNT remembers drive letters and stores this information in its registry. When the clone boots it will look at its cloned registry and be inclined to retain the drive letters that the parent had assigned to partitions. This is obviously a problem if you need the clone to assign a different drive letter to a partition, particularly its own. If the parent saw itself as the C: drive then the clone will also have to see itself as the C: drive. With Vista however I have found that in most cases it will automatically adapt and make its new partition the drive letter that it needs to be, regardless of whether the parent or any other partition is hidden or not. I'm only getting a few exceptions to this and mainly only for logical partitions on second or higher hard drives, but hiding all partitions on the boot drive for the first boot of the new clone will prevent even this problem.

If you do have trouble with a clone or restored image assigning itself the wrong drive letter you should still be able to boot Vista by clicking through various dll errors and so eventually get to a limited desktop, or in some cases just to a completely blank light blue screen. In previous WinNT recovering the OS from this situation could be difficult, but in Vista it is relatively easy and can often be done from that loaded desktop. All you have to do is change the drive letter back to what it needs to be. Once you reach the limited desktop or the blank screen press Ctrl+Shift+Esc or Ctrl+Alt+Del to open Task Manager and then click 'New task...' and run diskmgmt.msc and once the Disk Management utility fully opens determine which drive letter has been assigned to your clone. Then 'New task ...' again and this time run regedit and navigate to the key described in the screenshot below. Right click on the \DosDevices\ entry that has the letter currently assigned to the clone and choose 'rename' and change the letter to the one the parent sees itself as when you are booted into it. If your clone's registry already has that letter assigned to another DosDevices entry you will need to change that one first to free up the required letter. You can make it anything for now as you can change it again later in Disk Management. (If diskmgmt or regedit refuses to open for you then reboot into safemode. In Windows 7 in safemode you will also have to tick the new option "Create this task with administrative privileges.").

If you still can't get Disk Management to open but regedit works then you can make an educated guess which DosDevice is the clone and change its letter and try rebooting. Repeat if necessary with all the entries until you get the right one. Or you could just delete all entries and let Windows completely rebuild the list on reboot. This may do the job, or just take you back to where you started. Completely clearing the drive letter list is a useful trick in XP based operating systems to cure drive letter problems, (Warning for Win2K users - this edit can make 2K unbootable if various other factors are not correct). It has its risks with any WinNT and should not be attempted lightly for anything other than boot drive primary partitions unless you really know what you are doing. For Windows on second or higher hard drives or logical partitions, or if you are using the MS bootmanager or have made changes you didn't understand with EasyBCD or VistaBootPro, then you should use with caution. For Vista OSes that are already having problems then you have little to lose and should still be able to recover with the procedures described on this page.


Resetting the MountedDevices List

Sometimes the list in MountedDevices can become very long with many old and defunct entries, particularly after cloning. Occasionally this can cause a problem with letter allocation for removable USB devices, so clearing the list just for this reason can be useful. For boot drive primary partitions this requires no precautions other than not having the MS bootmanager configured and the OS seeing itself as the C: drive and both the System and Boot partition. For other hard drives or logical partitions then additional conditions need to be correct if you are not going to give yourself problems. With Vista it will just take a fully compatible bootmanager that drive swaps correctly and sets the Active partition to the one you are booted into. You should then be able to clear MountedDevices completely and reboot with no problems, then reset your optical drives etc and any data partitions to the desired letters. The safer alternatively is to keep just the DosDevices lines for any drives or partitions that currently have the desired letters assigned to them. This will retain those letters to those DosDevices while rebuilding the list for anything else.

No comments: