My 3TB USB disk I use as my Time Machine target has gone bad. I can mount it read only but no set of options I've tried allow me to mount it read/write.
The fsck tells me that the catalog btree is bad and I can not repair it because there is not enough space left on the disk to allocate a new btree (these are messages I get from fsck_hfs).
The Apple support article says to just open the volume in the finder and copy the Backups.backupdb to a new drive. When I try that, the "preparing to copy" dialog comes up. After 26 hours, it is at 3.8 million files but it has stopped moving. My fear is the btree is in a circular loop and it got stuck -- maybe?
When I try to copy the old volume to a new volume using ditto, I get lots of errors about "Operation not permitted". I believe the time machine disk has some fairly unique directory structures and I guess ditto doesn't know how to recreate them properly?
I thought about using ditto and create a big cpio file but then what would I do to restore it? I assume I would get the same errors. And, I also have the fear that if the directory structure is really goofed up, it might not ever finish.
To be honest, this is not a tragic loss. I could just reformat the drive and start fresh with backups and give up all of the historical data which, 99.99 chances out of 100 I would never want. So, this is a bit of an opportunity to poke at it and see if I can find a way to recover the drive without any huge heartbreak if I destroy the file system mucking with it. Or, I could just retire the drive and if I really really really need something off of it, I could mount it and pull just that piece off.
Another possibility is to write a program to traverse the tree keeping track of the inodes. For each unique inode of a regular file, copy that file to the new disk using an inode unique path. For each repeat inode, don't go down into the tree. Also, in to a separate file, record the paths to get to an inode. The big ICK there is all the extended attributes and ACLs that Apple / HFS has. I don't know how to get the complete set of these things. Is there more than just ACLs and extended attributes? Perhaps such a critter already exists.