I have a backup of a Windows 7 drive (virtualbox install) made in .raw format and I want to extract it to my empty partition ready for Windows. Im using OSX. Any ideas?
I have tried this:

sudo dd if=/Volumes/DATA/bootcamp.raw of=/dev/disk0s6

Which works fine but when I reboot (im on a hackintosh so im using the Chameleon boot loader) I get the normal Chameleon boot menu but with an unknown GPT partition (thats what its called) and If I select that it says: Missing Operating system. Is the MBR broken on that partition?

1 Answer
1

You forgot to provide some key information so I will state some assumptions before answering your question.

You have a RAW/dd image of an entire disk which includes the partition tables (MBR by the looks of it) and a file system in one of those partitions

You want to write this disk image to an existing partition (GPT) on a separate disk

The problem is that you are nesting a partition table within a partition table and mixing partition table types to boot. So you have a GPT partition table and one of those partitions doesn't contain a file system like NTFS, but rather it contains an MBR partition table with a partition for NTFS.

To solve this, you will need to skip the partition table portion of the raw/dd image and just copy over the file system part of the image to your destination partition. Also, you will probably need to make sure that the destination partition has the correct file system type set.

Quick and Dirty Solution:

sudo dd if=/Volumes/DATA/bootcamp.raw of=/dev/rdisk0s6 skip=63 bs=16K

More Accurate Solution:

install The Sleuth Kit (TSK) to calculate exactly where the file system is located

mmls /Volumes/DATA/bootcamp.raw; This command will tell you the start of the file system and the length. Look for the file system you want under Description. You probably want the one that says NTFS.

sudo dd if=/Volumes/DATA/bootcamp.raw of=/dev/rdisk0s6 skip=$Start bs=1 count=$Length; Fill in the $Start and $Length variables with your values calculated from step 2. Also this will probably run really slow since we are setting the block size to 1 which will hurt buffering but you will copy exactly all the bytes in the FS and not a single byte more.

*Note that both of the above solutions assume that you have only 1 partition on your Windows system. If you have more partitions, then you will have to use the second solution and adjust for the additional partitions