Copying Windows to a new drive, using DD in Linux
I just installed a new and bigger harddisk in my mum's laptop, and wanted to preserve the dual boot setup, with Windows XP and Fedora. Actually, it was enough to keep the Windows partition, since the Fedora was lagging behind a few updates.
Using a generic, but extremely useful IDE-to-USB adapter, I could copy the full Windows partition over to the new drive, without having to reinstall or change anything. Credit goes to Ed Anderson for putting together this guide to help with that task. To summarise the gist of it:
The internal drive was on /dev/hda, while the new and temporarily external was /dev/sda.
- The first step was to examine hda, and record the old partition details, system ID, and START and END in sectors:
fdisk -l -u /dev/hda - Then run fdisk on the new disk, also working in sectors:
fdisk /dev/sda
u (for sectors)
n, p, 1, START, END (new partition, with same START and END sectors)
a, 1 (set boot flag)
t, ID (set same ID as old partition)
w (write and quit) - Now we're ready to copy the data. First the Master Boot Record (MBR), and then the Windows partition:
dd if=/dev/hda of=/dev/sda bs=446 count=1
dd if=/dev/hda1 of=/dev/sda1 bs=4096 - Then insert the new drive at the location it should live in.
- Install Fedora using your favourite method, making sure you create a grub boot loader which has the Windows partition as an option.