Linux tip, Fedora tip / howto: Transfering Windows 2000 to another disk (using Linux)

 
Note that these tips are mostly outdated


back to notes and tips index

Try my online puzzle page with Calcudoku, Killer Sudoku and online Sudoku.

Transfering Windows 2000 to another disk (using Linux)

Note: procedures like these allow for no mistakes. If your setup is only slightly different (not dual boot, another version of Windows, etc.), make sure you know what you're doing before you attempt to do this. Read the entire page first, as well as this page on how to copy Windows 2000.

I replaced my frequently crashing Western Digital hard disk with a nice and quiet Samsung Spinpoint disk. On the old disk, Windows 2000 was sitting in the last (4th) primary partition, a FAT32 one. From fdisk /dev/hda, p:
Device Start End Blocks Id System
/dev/hda4 12113 14115 16089097+ c W95 FAT32 (LBA)

The drive has 255 x 63 = 16065 sectors per track, so the Windows 2000 partition has 16065 x (14116 - 12113) = 32178195 sectors = 16089097.5 1K blocks.

Some of the key info here is from this page on how to copy Windows 2000. The difference is that those instructions tell you to run a small extra installation of Windows 2000 (the "Rescue OS") to be able to copy the files from the source to the destination disk (otherwise you'd get a "sharing violation" for certain files). Here we'll copy the whole partition from Linux, using dd, so you won't need a third "Rescue OS".

I hooked up my old disk as a master on the first IDE channel (/dev/hda), and the new disk as a master on the second channel (/dev/hdc). I then created a partition for Windows 2000 on the new disk, fdisk output:
Device Start End Blocks Id System
/dev/hdc3 9563 11602 20482875 c W95 FAT32 (LBA)

So the new partition has 16065 x (11603 - 9563) = 32772600 sectors = 16386300 1K blocks. I'm not sure why I made the new partition slightly larger than necessary. Obviously make sure the destination partition is not smaller.

Next, I booted using the Fedora Core installation CD, and did not start network services, and did not let it search for and mount exisiting FC installations (both unnecessary). Then, the big step, copy the Windows 2000 partition (triple-check that you set the right source and destination before you hit enter...):
dd if=/dev/hda4 of=/dev/hdc3
(to make this go faster you can add a bs=1MB (block size) parameter)

You can press Ctrl+Alt+F2 to get another shell, in which you can type:
ps -ef | grep dd       (to get the process id of dd)
kill -USR1 <pid>       (with <pid> the process id of dd)
Go back to the first shell with Ctrl+Alt+F1, and see that dd has printed the number of sectors written so far.

When it's done, reboot (with both disks still hooked up), and boot into Windows (i.e. the Windows 2000 installation on your old disk, which is still at /dev/hda).

Next, the steps as listed on this page (refer to that page for more details): on the new disk, you have to edit the registry so Windows will assign C: to your new drive (if you don't do this, after you login to your new Windows, it'll complain about a missing pagefile).

  • run regedt32
  • select Window -> HKEY_USERS
  • select Registry -> Load Hive
  • load the file e:\winnt\system32\config\system, i.e. the registry on your new disk (assuming now your new disk is at e:, this may be a different drive letter)
  • call this file Temp
  • locate Temp -> MountedDevices
  • copy and paste the full hex key for your old drive (at C: presumably), and the new one (say E:)
  • next, edit both values such that the hex keys are swapped
  • select Temp, then File -> Unload Hive

There now is a working copy of the Windows 2000 installation on the new disk.


← back to notes and tips index
Please do not copy the text of this tip (© Patrick Min) to your web site.