Wanting to join the world of OSx86 but don't want to loose your files on your PC for the repartitioning? Or spend countless hours restoring a backup for your windows partition?

Say no more, since the Linux world has been nice to us Mac users we have all of the toys and gadgets to rip a NTFS partition and slim it down.

Before anyone spouts off on why I chose this way of making a backup is because dd doesn't like the NTFS very well and it can lead to a dead MBR (Master boot record). Not to mention NTFSCLONE scans the drive and only copies sectors that have files in them so say you have a 80GB hard drive and only 5GB is used it will make a 5GB image instead of the whole drive getting dumped into a 80GB image.

What software do I need?
All you need is MacPorts installed and the ntfsprogs suite.

Install MacPorts if you don't have it installed already.
In terminal use this command.
sudo port install ntfsprogs

No go to the root of your drive and create a new directory called backup
cd / | mkdir backup

Now connect the windows partitioned drive to the mac and run Disk Utility. Click on the drive and select Info. Look at the line Disk Identifier, it should say something like disk1. Also take note on the line Disk Number. In Linux terms the drive resides as /dev/disk1 but when the partition is mounted its known as /dev/disk1s1.

Leave Disk Utility running and open up Terminal. I'm going to use the Disk Identifier and Disk Number from my backup, so don't just copy and paste the code for just incase.

Backing up the MBR (Master boot record)
sudo fdisk -d /dev/disk1 >/backup/master-fdisk-sda.dump

sudo dd if=/dev/disk1 bs=512 count=1 of=/backup/master-sda.mbr

Backing up the partition itself using ntfsclone
Go back into Disk Utility and click UNMOUNT for the windows partition then go back to Terminal.
sudo ntfsclone -s -o - /dev/disk1s1   | gzip | split -b 1000m - /backup/master-sda.img.gz_

Now if you have multiple windows partitions you can save them all by issuing the command again but change the Disk Number and the saved file label, here is a example of saving multiple partitions.
sudo ntfsclone -s -o - /dev/disk1s1   | gzip | split -b 1000m - /backup/master-sda1.img.gz_

sudo ntfsclone -s -o - /dev/disk1s2   | gzip | split -b 1000m - /backup/master-sda2.img.gz_

Restoring the image
Now before you install OSx86 you want to repartition the hard drive. Since you already got Disk Utility running you can go ahead and delete the partition and create a multiple partition shceme. It doesn't matter what partition type you use but make sure you have Boot with MBR selected in the Security Options.

To keep things simple we are going to make the Windows partition first on the drive, this way you won't have any conflicts with the MBR.

After you have created the partitions take note again on the Disk Number. My system listed it as Disk1s1 and Disk1s2. So Disk1s1 is my Windows partition and Disk1s2 is my OSx partition.

In Terminal go into /backup
From there you can restore the MBR and partition.

MBR Restore
sudo fdisk /dev/disk1 < /backup/master-fdisk-sda.dump

sudo dd if=/backup/master-sda.mbr of=/dev/disk1

Restoring partition
NOTE NTFSCLONE has created a few images files. Each one is 1GB and they need to be combined before you restore them. Issue the LS command and take a peek at what is there. Since my partition was 5.5GB I have 6 files total.


Now to combined them and restore just issue this command
cat master-sda.img.gz_aa master-sda.img.gz_ab master-sda.img.gz_ac master-sda.img.gz_ad master-sda.img.gz_ae master-sda.img.gz_af   | gunzip -c | ntfsclone --restore-image --overwrite /dev/disk1s1 -

Now after restoring the image you can put the drive back into your PC and test to see if Windows boots. If it works then go ahead and install OSx86. If for some reason it doesn't work try again, if it still fails just create a single partition and restore the Windows partition and do things the old fashion way.