I recently used GNU ddrescue to save a 6TB drive that was having troubles. When I would try to mount the drive, fsck_hfs determined it couldn't be fixed (it was trying to rebuild the catalog b-tree, but then said the disk was full and it couldn't write it). The drive would then mount read-only, and I found that I would get an input-output error if I tried to ls into my Time Machine backup directory. After trying many things that didn't work, I decided to just ddrescue it to a 6TB .dmg, which did work with no bad sectors.
So, now I have a 6TB .dmg image of the drive, and I find that it has the same issues: fsck_hfs thinks it cannot be fixed, and it gives input/output error when trying to ls into the Time Machine directory. I subsequently formatted the external drive, and it seems to be fine, so I think it was never a hardware issue.
I found out that although ls doesn't like the Time Machine directory, rsync seems fine with it. When I try to sync the directory to a new disk with rsync -avhHW --progress <image> <dest>, the output lists all the files I expect, and I can successfully see them appearing on the destination. However, this doesn't seem to work for copying a Time Machine directory, because the size balloons on the destination. rsync used to have --hfs-compression and --protect-decmpfs options, but they seem to be broken in v3.1.3, and as discussed here those may not be enough anyway. Indeed, I find that I've filled a 6TB destination before even making it through half of the directories in the 6TB image.
I am trying to copy the files through Finder now, but it is (understandably) spending ages just preparing. I liked the idea of using rsync not only because it could actually see the files, but because it is ok if interrupted.
So, does anyone know why rsync can see these files when ls can't? Is there any way I can copy them over in a way that is safe to be interrupted but doesn't ruin the hfs+ compression or mess up the hard links (or hard-linked directories, which is what this post claims is the problem with rsync even when it did have the old options)?
Any insight is greatly appreciated.
rsyncand Apple'sdittosucceeds. So maybedittowould be useful for you to try here? – woolfie Sep 20 '19 at 18:43ditto. I haven't tried it yet, I will do that next! Thank you. – Andrew Patrick Turner Sep 20 '19 at 19:01fsck_hfscould repair it, since it claimed the issue was a disk full error. Alas, the .dmg created byddrescuecannot be expanded, so sayshdiutil resize -limits. My knowledge of these things is limited, but if there were another way to expand the size of the disk image, it's another thing I would want to try. – Andrew Patrick Turner Sep 20 '19 at 19:01