Install Windows on a PC.
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.
Mount the Windows C:-drive
ntfs-3g /dev/hda1 /mnt/windows
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 |
---|---|
This operation took an hour and twenty minutes, which is tenty-five minutes longer than the Windows install itself.
|
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"
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.
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
Create a filesystem on the NTFS partition.
mkfs.ntfs -f /dev/hda1
Mount the partition
ntfs-3g /dev/hda1 /mnt/windows
Restore the image onto the clean filesystem.
ssh user@another.machine.com "cat /home/user/C-disk.bz2" | tar xjvC /mnt/windows -f -
Install Grub in the MBR of the disk.
mkfs.vfat /dev/sda5
mount /dev/sda5 /mnt/boot
grub-install --root-directory=/mnt/boot /dev/sda
Make sure Grub has a stanza that looks like:
# rootnoverify (hd0,0) chainloader +1
Reboot the machine and try to boot into Windows via GRUB.