Is it possible to take a filesystem image and write it to a device to take up the space of the drive

2

Essentially what I want to do is create an image of a filesystem then write that filesystem to a flash drive. Currently I am trying to create an hfs filesystem in the form of a file on an ext3 filesystem. I am then using dd if=image of=/dev/sdb1. I then plug the drive into my mac and it tells me that it cannot repair the partition.

How can I accomplish this? I believe it has something to do with partition information not being on the drive but I am not sure?

user9962

Posted 2009-09-04T17:16:39.393

Reputation:

Answers

1

Currently I am trying to create an hfs filesystem in the form of a file on an ext3 filesystem

Usually this takes the form of a DMG file originating on a mac. It sounds like you're making a disk image in Linux and then:

I then plug the drive into my mac

So you're plugging an ext3 volume into your mac? That would explain why:

it tells me that it cannot repair the partition.

Your mac can't read ext3 volumes. Maybe you should format the drive for FAT, and then try this again.

jweede

Posted 2009-09-04T17:16:39.393

Reputation: 6 325

0

You can do this using Apple's Disk Utility (/Applications/Utilities/Disk Utility) or using hdiutil. This will create a .dmg disk image, which you can then restore onto another disk/storage device with Disk Utility or hdiutil. You can restore it on to a partition that is a different size than the original (as long as it is big enough to hold the contents). The image can also be stored as a file in any other filesystem that can be accessed by your Mac, and the file can be mounted simply by opening it in the Mac Finder.

If you want to use dd and copy the raw filesystem data directly, the destination partition should be exactly the same size as the source partition. Also you will probably want to copy from/to the device containing the partition (e.g. /dev/disk0s2) and not the whole disk (e.g. /dev/disk0). I'm not sure whether this will work going to a flash drive.

mark4o

Posted 2009-09-04T17:16:39.393

Reputation: 4 729