osx - How do sparse bundles get corrupted and can they be fixed?

06
2013-08
  • Thilo

    I am warming up to Mac OS X sparse disk image bundles: This is a virtual file system stored as a collection of small (up to 8MB) files in a folder. This way, you can have encrypted HFS+ volumes stored on FAT-formatted USB drives, or SMB network shares. And because the data is broken up into 8MB chunks, incremental backups work very well by just copying the updated fragments. No problem for rsync or Time Machine, even for encrypted data.

    But even though this format seems to have been designed with compatibility with non-Mac tools and file systems in mind, it does not seem to work for example with Dropbox. Why is that? Is it just some meta data ("bundle flag?") that gets lost in transfer (and that I could manually put back in)?

    The Internet is also full of horror stories of corrupted bundles on Apple's own Time Capsule network backup device.

    How do these bundles get corrupted and what are my recovery options?

  • Answers
  • mralexgray

    As far as I know, you can mount the .sparseimage, and run "Repair/Verify" in Disk Utility, like you could on any other disk....

    And like any other disk, always try to "eject" or dismount before powering off or restarting the computer..

    I have seen them get corrupted before, but not for a long time... I think it might have been a non-Snow Leopard issue. BTW, sparse "disks" are how Apple stores your "Home" folder when you use FileVault (which are gone in Lion, so don't go ecrypting your home folder, now... they just encrypt the whole disk)

    My favorite command is the following, which shrinks the sparseimage down to the actual amount of data you have stored in it, no matter how large it had grown to by adding files which you have now deleted..

    hdiutil compact /Macintosh\ HD/Path/to/Name\ of\ file.sparseimage

    BTW, the backslashes ( \ ) are only required if you have spaces in your file pathname.


  • Related Question

    mac - Is it possible to recover a deleted FileVault sparse bundle in OS X?
  • Questioner

    I made a huge noob mistake with my Macbook. I used Disk Inventory X to see why my drive was so full and it showed all my files under my user account as well as a huge amount of data in /Users/.myuseraccount called the sparsebundle. I had FileVault on but not Time Machine. I thought I might have used Time Machine to create an image of when I first got the computer, but I'm not sure if I did or not. It looked to me as if the data was completely separate files, but when I deleted the sparsebundle files, I could no longer log back into my account and now it shows my /Users/myuseraccount directory to be empty.

    PLEASE somebody tell me I didn't just lose everything. Only a small amount of these files were backed up elsewhere. I cannot afford to lose all this. Is there disk recovery software that can restore this? Or could I possible take it back to the Apple store?


  • Related Answers
  • Gordon Davisson

    After speaking with tech support, I have determined that there is no way to recover these files. With the encryption of FileVault, there would be no way to tell what the files were.