Preping dual boot for OSx86

Posted by: TCPMeta

Preping dual boot for OSx86 - 07/28/09 04:40 PM

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.
Posted by: Oelmuvun

Re: Preping dual boot for OSx86 - 07/29/09 03:17 AM

Alternatively, if you have it, you can drop $50 on a single platter 500GB HDD and stick that in your PC. :P
And if it comes down to "but then I have to use the BIOS's boot selector menu" you can just grab an old 512MB or smaller USB flash drive (that, lets face it, you do not use anymore) to store Chameleon on. You can just set the PC to boot off your flash drive in the BIOS.

Easy, and if you have to wipe a drive or one fails you do not have to reinstall or reconfig your bootloader since your bootloader is on a totally different device. laugh
Posted by: TCPMeta

Re: Preping dual boot for OSx86 - 07/29/09 03:25 AM

The whole point for that guide is if some Mac user that owns a PC and doesn't want to go though the heart acke to start from scratch with Windows. I wish I can get a 500GB hard drive for 50 bucks.
Posted by: Oelmuvun

Re: Preping dual boot for OSx86 - 07/29/09 03:30 AM

I am not trying to undermine you, just adding another option for those that can do it. Each way has it's place and validity.
And why would they be starting from scratch with windows? They would not be touching the windows drive at all.
Posted by: Oelmuvun

Re: Preping dual boot for OSx86 - 07/29/09 03:39 AM

Ok, so it is not single platter and not quite $50.. close though, I would have expected it to be slightly cheaper in USA compared with Canada.

these are $60

I am sure there are other drives on sale for close to $50 now and then though.

If you want sub$50 then it looks like there are 320GB and 250GB drives and such as well.