I am trying to make a disk image of a ~75 GB ext3 filesystem that I have mounted via FireWire. I am unable to mount the resulting image, however. What are the proper steps? These are the ones I tried and the results. First, When I run "Disk Utility" on the individual partitions, they all check out fine.
When I selected the disk (containing 6 partitions) in Disk Utility and selected "New Image," the ~75 GB disk resulted in a 173.75 GB image! Regardless, if I tried to double-click the image in the Finder or mount using Disk Utility, it would simply go forever (days) without doing anything.
When I used dd to image the disk:
% dd if=/Volumes/MyDisk of=/Users/me/myimage.dmg bs=100m
The resulting image was only 74.53 GB, but it would still not mount (it continues "forever").
I have run "hdiutil verify" on the images and they check out fine.
When I run "hdiutil attach" on the images, both images (large and small) seem to "attach" successfully but do not mount. Do I need to mount the devices separately? Running "hdiutil mountvol /dev/diskx" seems not to work either, as it says: "Timeout for DiskArbitration expired. Aborting..."
Any ideas? What are the proper procedures for making a read-only image from an ext3 filesystem and then mounting that resulting image?
I'm not sure about using Disk Utility to make a copy of a disk, I've never tried that. Is there anything in the system.log file to indicate what's going on?
With the dd method you will need to run fsck_ext2 on each Ext2 partition before trying to mount it. To do this, you will have to "attach" the image without actually mounting anything:
$ hdid -nomount <PATH TO IMAGE>
You should now have a /dev/ entry for each partition, and you can then run fsck_ext2 -y on each partition.
Thanks! What is then the command to mount the disk completely? Do I just hdid -mount imagefile.dmg or do I need to point to the /dev/diskx device?
Use the higher level hdiutil to do a normal mount:
$ hdiutil imagefile.dmg
This will attach and mount all recognized partitions using Disk Arb.
I'm not certain that I'm understanding correctly. Does the "fsck_ext2" step you suggested in your first response affect the .dmg file itself so that running hdiutil on the .dmg file will then be successful?
When I run hdiutil after having fsck'ed the disks until they stop saying "modified," I get this:
root# hdiutil attach /Volumes/RAID/narniaimg.dmg
...but nothing new shows up on my desktop, in /Volumes, or in the system.log.
Yes, I left out a step. After fscking, you have to detach the image, and then re-mount. Running 'hdiutil attach' on an image that is currently attached just displays the partition list (as you saw).
So after fscking, run:
$ hdiutil eject /dev/diskN
$ hdiutil /Volumes/RAID/narniaimg.dmg
Alternatively, after ejecting the image, you can just double click on it the Finder.
Thank you! The only problem I'm now having is with permissions. Despite unmounting a disk and enabling "ignore permissions" and "mount read-only" and then remounting, I still show both of these in the System Preference's pane:
Permissions Enabled: Yes
Now, the first one isn't correct at all. I can't write to it and the Finder's Get-Info shows that it's read-only too. The Permissions Enabled is correct, but I can't turn that off. How do I disable permissions if not with that toggle switch in the PrefPane?
If it helps, the Info.plist file is saying <string>amount</string> for FSMountArguments.
Hi -- any help on this problem with not being able to mount ext2 drives with permissions ignored be greatly appreciated!
I'm stuck on the first step. I want a backup of an ext3 filesystem from a CF card. It has about 80 megs of data on it.
$ sudo dd if=/Volumes/UNTITLED of=/Users/mls/twozones.image bs=512
2+0 records in
2+0 records out
1024 bytes transferred in 0.000237 secs (4320893 bytes/sec)
You are dd'ing a directory entry (the root entry in this case), which defaults to a one block size, or 1KB on a 80MB fs.
If you want to dd the raw filesystem, then you have to use the raw device:
dd if=/dev/disk?s? of=~/Desktop/copy.image bs=512
I would suggest you unmount the fs before attempting this.
Doh! Alright, I understand now. Hopefully this next one isn't as dumb. After dd'ing, I went to restore the image. All of the files are there, but it does not boot in the device (an i386 system). I googled and found a reference to this article, describing a necessary lilo update.
When I updated lilo.conf and tried to run it, I got this:
$ /Volumes/UNTITLED/sbin/lilo -r /Volumes/UNTITLED -C etc/lilo.conf
/Volumes/UNTITLED/sbin/lilo: line 10: /Volumes/UNTITLED/sbin/lilo.real: cannot execute binary file
Does that mean I just need to install a PPC version of lilo? Or am I barking up the wrong tree?
Well, if you are running lilo on OS X, then you definetly need a PPC binary (and an OS X binary on top of that). From the error, it looks like this is the problem, but lilo is a script of some kind that runs lilo.real which is the problem binary (not a Mach executable).
Also, if you want to copy the whole card (partition table and all), then you should be using the disk device and not one of the slices (partition).
So, /dev/disk? would be the whole disk, and /dev/disk?s? would be a slice (partition) on that disk. It could be that you are using a slice and not the whole disk.
Finally, whenever you dd a filesystem you should run fsck on it after restoring the image to media. This makes sure there are no inconsistencies do to possibly different media.
Thanks. Yes, I did dd disk1, and got the whole thing. It won't boot though. I should have mentioned the original article that linked the one above:
I was hoping I could do this project just with my powerbook, but I guess it was not to be. I still appreciate your efforts tho - very handy.