Image and Mount

Help
2004-10-18
2013-05-02
  • Sean Peisert
    Sean Peisert
    2004-10-18

    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?

    Thanks,
    Sean

     
    • 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.

      HTH.

       
      • Sean Peisert
        Sean Peisert
        2004-10-18

        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?

        Thanks,
        Sean

         
        • Use the higher level hdiutil to do a normal mount:

          $ hdiutil imagefile.dmg

          This will attach and mount all recognized partitions using Disk Arb.

          HTH.

           
          • Sean Peisert
            Sean Peisert
            2004-10-18

            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
            Initializing...
            Attaching...
            Finishing...
            /dev/disk4              FDisk_partition_scheme        
            /dev/disk4s1            Linux_Ext2FS                  
            /dev/disk4s2            Linux_Ext2FS                  
            /dev/disk4s3            Linux_Ext2FS                  
            /dev/disk4s5            Linux_Ext2FS                  
            /dev/disk4s6            Linux_Swap                    
            /dev/disk4s7            Linux_Ext2FS

            ...but nothing new shows up on my desktop, in /Volumes, or in the system.log. 

            Any ideas?

            Thanks,
            Sean

             
            • 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.

              HTH.

               
              • Sean Peisert
                Sean Peisert
                2004-10-20

                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:

                Writable: Yes
                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?

                Thanks,
                Sean

                 
    • Sean Peisert
      Sean Peisert
      2004-10-20

      If it helps, the Info.plist file is saying <string>amount</string> for FSMountArguments.

      Thanks,
      Sean

       
    • Hi -- any help on this problem with not being able to mount ext2 drives with permissions ignored be greatly appreciated!

      Thanks,
      Sean

       
    • 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)

      any ideas?

       
      • 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.

          http://article.gmane.org/gmane.comp.hardware.soekris.technical/3484

          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.

            HTH.

             
            • 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:

              http://lists.soekris.com/pipermail/soekris-tech/2004-January/019861.html

              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.