The experiment

Procedure 73.  Cloning an NTFS partition step by step

  1. Install Windows on a PC.

  2. Reboot the PC into some Linux that has the NTFS-3G driver (and that doesn't touch the Windows partition). I used the System Rescue Live Distro.

  3. Mount the Windows C:-drive

    ntfs-3g /dev/hda1 /mnt/windows

  4. Copy the contents of the C:-drive to another machine

    tar cvjC /mnt/windows -f - ./ |ssh user@other.machine.com "cat > /home/user/C-disk.bz2"

    [Note]Note

    This operation took an hour and twenty minutes, which is tenty-five minutes longer than the Windows install itself. bzip2 Is rather slowish, and the filesize obtained with it is only marginally smaller than with gzip.

  5. Just to make sure, copy the contents of the first 16 512-byte sectors of the system as well. Windows may have stored data there that is required for booting.

    dd if=/dev/hda1 bs=512 count=16 | ssh user@other.machine.com "cat > /home/user/C-bootsect.dd"

  6. Take a different PC, and boot it into your Live Distro. Prepare the system for Linux install by repartitioning (you can use fdisk). Make at least a primary NTFS partition (type 7) with enough space to hold the data we just copied away. Make it a different size from the one you took the image from, and make it active, too. While you're at it, make a small other partition that will hold Grub's stage2.

  7. Just to make sure we're not helped inadvertedly by an old Windows that was ever on that disk, wipe out a couple of thousand bytes from the beginning of the Windows partition.

    dd if=/dev/zero of=/dev/hda1 bs=512 count=1000

  8. Create a filesystem on the NTFS partition.

    mkfs.ntfs -f /dev/hda1

  9. Mount the partition

    ntfs-3g /dev/hda1 /mnt/windows

  10. Restore the image onto the clean filesystem.

    ssh user@another.machine.com "cat /home/user/C-disk.bz2" | tar xjvC /mnt/windows -f -

  11. Install Grub in the MBR of the disk.

    Make sure Grub has a stanza that looks like:

    	    #
    	    rootnoverify (hd0,0)
    	    chainloader +1
    	  

  12. Reboot the machine and try to boot into Windows via GRUB.