How to copy a Windows installation

From ThinkWiki
Revision as of 16:35, 20 September 2007 by BuelensC (Talk | contribs) (Adjusting drive letters)
Jump to: navigation, search

This page provides assistance in seemlessly copying a working Windows installation to a new partition/harddrive, so that afterwards it seems like nothing has happened.

Filesystem based copy of Windows 2000 or XP

ATTENTION!
If you follow these instructions, you do it on your own risk. Even though this process was successfully executed at least once, no success is guaranteed and data loss can happen. Since no modification to your old harddisk is done, data loss is unlikely. However, it is possible.
NOTE!
A similar process, however, involving a (temporary) second Windows installation has proven to be reliable. It is safer to do the copy from a second Windows installation since then the running system doesn't interfere with the files copied. The steps needed in this case are very similar.

If you want to transfer a working Windows 2000 or XP installation to a new harddrive, the following method has proven reliable. After the process your system will boot into the new system as if nothing would have happened.

The Process

The outline of the process is as follows:

  1. We use Windows to partition your new harddrive and format the new Windows partition.
  2. We copy the whole content of your old Windows partition to the destination partition.
  3. We tweak the registry on the destination partition.
  4. We boot the destination partition.

The Advantages

  • After the process your new Windows will be exactly the same as the old one (see notes below).
  • Since we use Windows to partition the new drive we make sure the partition table is compatible.
  • Since the copy is filesystem based, your new installation will automatically be defragmented.
  • Your destination can be bigger (or even smaller) than the source one, without the need of using tools like ntfsresize afterwards.
  • We only use builtin tools, except for scopy, which is part of the Windows NT Server Resource Kit.

Prerequsites

  • This guide assumes that you can connect a second harddrive to your ThinkPad, be it via USB, PCMCIA or a UltraBay harddrive adapter.
  • Get scopy from here and place it on your old partition.

Preparation

  • Attach the new harddrive to your ThinkPad.
  • Boot up your Windows installation.
  • Open the Disk Management Interface and partition your new harddrive. Set the partition that your system should be copied to as active. Also assign a drive letter, we will assume it is T: .
  • Format this partition as NTFS in long format. This is important, because else the boot sector will not be installed to that partition.

Copying

Open the command line interface (cmd.exe) and use scopy to copy all files from your old partition to the new one. Lets assume, your old system is on C:, then the command would be:

<path_to_scopy>\scopy.exe C:\*.* T:\ /a /o /s

We do this with scopy, because scopy preserves NTFS file attributes and access rights while copying.

Wait patiently till the copy is finished. You can now open T: in your Windows explorer to check if things went well.

Adjusting drive letters

  • After the copy finished, open regedit.
  • Mark HKEY_USERS and select "Load Hive..." from the "File" menu. Open T:\WINDOWS\system32\config\SYSTEM.
  • You will be promptet for a name for the new hive, you may use i.e. "TEMP". The new hive will be attached to HKEY_USERS.
  • Expand HKEY_LOCAL_MACHINE\SYSTEM and select the MountedDevices key there.
  • DoubleClick "\DosDevices\T:" and mark the whole binary value. Press CtrlC to copy the value.
  • Expand HKEY_USERS\TEMP and select the MountedDevices key there.
  • DoubleClick "\DosDevices\C:" and mark the whole binary value. Press CtrlV to replace it with the copied value.
  • Mark HKEY_USERS\TEMP and select "Unload Hive..." from the "File" menu. Confirm the request.
  • Close regedit.
  • Shutdown Windows.

Some steps above can be made a bit simpler. Above you copied drive C: to T:, so boot the copied drive it must become C: and the source may become T: (thus simply switch the drive letters). Swapping the keys in "\DosDevices\" is easier than the above steps:

  • select "\DosDevices\T:" and in the Edit menu, select Rename, then overtype the T: with a temporary name, like NewC:.
  • select "\DosDevices\C:" and in the Edit menu, select Rename, then overtype the C: with T:.
  • return to the previous key (where you entered the temporary name, "\DosDevices\newC:" in the example), select Rename once more in the Edit menu, and overtype the temporary name NewC: by C:.

Booting the new System

Now, replace your old internal harddrive with the new one and power up your system again. The new system should boot as if nothing happened.

External Sources