How To Fix A Corrupt Encrypted Sparsedisk Image

Hello MacScripters,

Recently my Finder crashed while I was copying about 150 PDFs from an encrypted sparsedisk image. The files seemingly all got copied. I could see the list in the target folder and each file had been given the PDF icon, which usually happens after the files have finished copying. But the copy window would not let go ” the progress bar just keep chugging away. After a very long wait, I finally relaunched the Finder. After restarting and trying to mount my sparsedisk image, I learned that it had been corrupted. When I try to mount it I get the message: The following disk failed to mount, Reason: corrupt image.

While searching the Web for a possible fix, I discovered a Web page that offered a lot of promise. A fellow named Lorenzo Perone had solved a similar problem by using Terminal to copy the header of a working backup copy of his sparsedisk file to the broken sparsedisk file.

I tried to follow Lorenzo’s step-by-step instructions but could not get it to work for me. What I got were results such as “no such file or directory found” and “no skip value indicated.” Since I know virtually nothing about Terminal and am prudently intimidated by it, I am hoping that some of you Unix wizards will take a look at his Web page and untangle it for me.

I am hoping for an applescript that will let me:

  1. choose my broken sparsdisk (a copy, not the original)
  2. choose my good sparsedisk (a copy, not the original)
  3. tell Terminal to test for the location of the header and give me feedback that it had found it and indicate if it is at the beginning or the end
  4. copy the good header to replace the bad header and give feedback
  5. try to attach (without mounting) the sparsedisk and give feedback
  6. test the file system and give feedback
  7. detach it and give feedback
  8. try to mount it.

This could be a lifesaver for those, like me, with a corrupt sparsedisk image. If you are willing to help, please have a look at:

http://lorenzo.yellowspace.net/corrupt-sparseimage.html

Also, note the last comment by gogool on this page:

http://www.macosxhints.com/article.php?story=20070419082314524

He discovered a way to create a good header by making a new sparsedisk image of the same size with the same password. It would be useful to have Terminal query the broken sparsedisk for the original size, if possible, for those who might need to use this method.

Many, many thanks to all who give this a go.
icta

Model: 2.66 GHz Dual-Core Intel Xeon G5
AppleScript: 1.10.7
Browser: Safari 525.13
Operating System: Mac OS X (10.5)

Please note, my OS is actually 10.4.11, I failed to set the pull-down correctly in my last post.

icta