9 Replies Latest reply: May 29, 2008 3:03 AM by m::se
preloeder Level 1 Level 1 (0 points)
A recently made a backup using TM to a fileserver (linux, running AFP, SMB and NFS) . All went well so when my laptop started to act up (spotlight of death problem) after a crash I decided to reinstall my laptop and later restore the bckup I had.

First off, you cannot choose unsupported disks when trying to restore from the boot DVD. Not to big a problem for me but be warned! I resumed the fresh installation and set time machine to use my linux server for backups. I immediatly turned time machine of since it wanted to start a backup within seconds and I opened TM and voila! all of my files ready to restore, or so I thought...

For some unclear (not OSX realted) reason 2 disks in my RAID 5 array of my linux server failed within seconds of each other... I was left with a big mess suffice it to say. I managed to rebuild my array with minor damage now running in degraded mode. The biggst problem (offcourse) is that the .sparsebudle image is also affected. I have been googling myself crazy but I cannot find a (working) method to fix this problem. TM (or rather OSX) won't mount the image because it can see it has defects. I'd rather the image was mountable with perhaps some files broken then not be able to access ANY of my data at all!

Does anyone know of a way to make osx mount the bl**dy image and allow me to at least restore some of my files? I do not mind working in terminal, I do not need the fancy TM interface, I at least want my mail archive (7 years worth) back

Any help wouldbe highly appreciated!


Mac OS X (10.5.1)
  • Ken Hart Level 1 Level 1 (125 points)
    You could try to mount it in terminal using the -shadow option with hdiutil (see man page). The shadow option will essentially create a working swap file for the mounted image. This is normally used to mount a volume that you don't want to actually change to be read/write while mounted. I've had some success with this in which the image volume has a "dirty" journal and won't mount normally.

    Also I think Disk Utility has some options to verify/repair a dmg file. I just tried it on one of my (unmounted) dmg files and Disk Utility crashed (you've been warned, try it at your own risk on a copy first!).

    Good luck
  • preloeder Level 1 Level 1 (0 points)

    I tried your suggestion but as with all mount tries I get the following error:

    hdiutil: attach failed - no mountable file systems

    I can attach the image with the -nomount option and disk utility can even see it then but I cannot repair it (since he does not beleive there is a file system on/in it)

    So thanks for the tip, I will use the shadow option once I got it up and running for safety, bu for now no luck
  • Ken Hart Level 1 Level 1 (125 points)
    Hmm. OK one more idea. Is the sparseimage a GUID volume (introduced on Intel based Macs) and you are trying to mount it on an older version of the OS which doesn't support GUID?

    I have encountered problems mounting a GUID volume image on older versions of OSX which don't support GUID (hence the no mountable file system error).

    Or, I hate to say it, since your losing valuable data, but when your RAID crashed, the sparseimage was corrupted too much to be recovered/repaired.
  • preloeder Level 1 Level 1 (0 points)
    The image was build on the same machine I am trying to mount it on right now. Allthough it was uildbij TM offcourse and not manually or through some other tool. The only difference really is that I used netatalk to share an AFP drive from my linux boc when I ran TM. SInce the machine crash netatalk has died on me as well and I am now using SMB to present the direcotry to my mac. This should not change anyting really since they are merely different protocols, they've got nothing to do with the underlaying filesystem.

    Oh, btw, it is a G4 powerbook, both installs were (offcourse) OSX 10.5 (hence timemachine ;)) so no intel stuff here. I am beginning to worry that th image might be beyond repair indeed. The only reason I can think this beeing the case hoewer is when the header of the image was damaged (or certain config files or smth) since having a few broken datablocks (sparse image creates 8mb blocks) should be a recoverable error IMHO. If not, then this design *****, pardon my french, and Apple should REALLY fix that deficiency.

  • Ken Hart Level 1 Level 1 (125 points)
    That's too bad. You're down to the bits and bytes it seems.

    The partition block could be rebuilt, provided you know the structure and if it was the only thing damaged (you sound to be capable of this) But, if the data area is damaged also.....

    There are several file recovery programs on the market that you could look into that might be able to recover the individual files, I've haven't used any in a while so I don't know if they will work on an unmounted volume (is it compressed/encrypted also?)

    Good luck (again). It seems I wasn't much help. Post an update on your efforts, I'm really interested to know if you're successful and what worked.
  • preloeder Level 1 Level 1 (0 points)
    Finally! some succes, and thanks for the tips Ken

    Ok, what I did:

    I took the damaged .sparsebundle direcotry from my network drive and copied it over to my iMac (has the largest disk). I then mounted, sorry, attached the image like with

    *hdiutil attach -nomount (imagefile) -shadow /tmp/test.shadow*

    Then I borrowed a copy of data rescue II form a collegue and switched to expert mode. There I could select the image file and did a thorough scan. This took like 8 hours or so (since the image is virtually 894GB) but in the end it had found a lot of files, some including filenames and atributes, some only identified by type (and thus named by the program for example: mp300001.mp3) and a whole load of orphaned file. These files are strangely cut up if they are larger then 1GB (I had quite a large image file which was chopped up) but for the most part a whole lot of files were dumped into these folders with their name intact so I could sort through them. Seeing as I have some 20.000 directories filled with them allready I had better write some script for it...

    Suffice it to say that it was not a usable image anymore that TM could use in any way. Fortunatly the program did recognize such things as iTunes library, applemail and so on. I am currently recovering all files to a directory outside the image and from there I will be manually sorting things out.

    So far so good, but be warned all of you using sparse images! When you have a few bad sectors or as in my case a non-clean disk in your array with plain files, chances are you can recover a lot of them. With a disk image like in my case a few of the wrong files get damaged and you loose a LOT of data. In my case I would estimate about 60% (most of those thank god were programs and library files which I can simply reinstall from dvd/cd). In other words: it is better to go to some length of effort to make TM backups in the way TM was originally meant; files or hardlinks, not images!

  • Turbofan Level 1 Level 1 (10 points)
    Thanks for sharing your solution! I was in the same boat. I tried to compact a backup image and ran into problems trying to mount it thereafter. I used the method you tried and used Diskwarrior to repair it so that it would mount.
  • Fisslefink Level 1 Level 1 (0 points)

    This error can be caused if the server partition containing the sparsebundle is mounted as "read only" ... This is often the case after an improper shutdown, and it mostly affects hfs and hfsplus file systems, since Linux does not know how to repair them by default. It may occur with other file systems as well.

    Before you go destroying your sparsebundle as recommended on this thread, try these things:
    - If your sparsebundle is on an hfs or hfsplus file system, run 'dmesg|grep hfs' on the file server to see if the partition was mounted read-only.
    - To be extra sure, try making a new folder ('sudo mkdir testfolder') on the partition that contains the sparsebundle -- if you get a 'read-only' error, you know something is wrong.

    To make an hfs or hfsplus partition mount read/write again, you need to run fsck.hfs (aka fsck.hfsplus), which is hard to find and you may have to compile it yourself. My post at Ubuntuforums.org ( http://ubuntuforums.org/showthread.php?p=4697212#post4697212 ) should help you do that.

    Good luck.
  • m::se Level 1 Level 1 (10 points)
    I had the same problem and found out how to fix it
    You can check the whole process here in a post I wrote for the Hardmac blog (it's rather long...):

    How I saved my corrupted Time Machine sparsebundle image…