Friday, July 28, 2006

DamagedFiles, Recovered files, and lost+found: huh?

It's really important to treat a DamagedFiles folder that shows up after a crash and disk repair with respect. Research what each file or folder is by using the symlink to go to its original. Replace those files from a backup and repair permissions! There has been data loss.

Macworld: News: Inside Mac OS X 10.4.2:

"Next, the new Disk Management repair code creates a folder named DamagedFiles at the root level of the disk in question, and creates a real Unix symbolic link (not a Mac OS alias of any kind) for each of the affected files, named with the original CNID and the file name. In our example, if your Safari Bookmarks file had the file ID 45892 and the picture that overlapped an extent with it had file ID 81834, the DamagedFiles folder would contain two symbolic links, one named "45892 Bookmarks.plist" and one named something like "81834 DSCN0001.JPG", depending on the image's original filename. As noted, only one of these files can even possibly contain correct data, and they may both be corrupted. Thanks to the symbolic links, you can easily find them, and determine which newly untangled files to keep and which to replace.

Utilities like DiskWarrior have long repaired overlapping extents with similar procedures, but it's great to have this built into the operating system, if for no other reason than that Mac OS X uses this code to verify and repair your file system during startup when the computer wasn't properly shut down. If you see a DamagedFiles directory show up on the root level of your hard drive, stop what you're doing and look at the files within it. See which of the files are damaged, and either replace them from backup or recreate them. Then run DiskWarrior if you have it, or boot into single-user mode and run fsck so it can verify there are no more problems with your disk. (You can boot from your Tiger installation disk and run Disk Utility, but since it doesn't contain the Mac OS X 10.4.2 version of this code, it won't do as well with overlapping extents, so we recommend single-user mode first.)"

More info can be found here as well.

Also keep in mind you might see orphaned files stuck in a folder at the root called "lost+found": -- Top Ten Mac OS X Tips for Unix Geeks: "lost+foundThis directory stores orphaned files discovered by fsck."

If you find a Recovered Files folder in your trash when starting up, Apple has the explanation here. Basically, OS X is cleaning up after applications that either crashed or did bad housekeeping:

Mac OS X 10.4 Help: A folder called Recovered Files appears in my Trash: "One or more Recovered Files folder may appear in your Trash after restarting your computer."

No comments: