One of my Seagate drives suddenly started acting really weird. It wouldn't let me delete files from it, copy new files on to it, etc. Copying files off the drive seemed to work fine, but when I tried to run Disk Utility to validate the file system, it gave an error complaining about being unable to dismount the file system - someone had it busy.
Quick trip to the Terminal and tried:
$ sudo lsof | grep VOLUMENAME
and that showed a couple of issues, OneDrive, GoogleDrive, etc keeping files open, so I quit those apps and tried again. Same dismount problem, even though there were no open files that the system would tell me about. Hmmm, real Unix fsck can run on a mounted filesystem, surely the hfs variant can? Yep. First, work out the device name with mount ...
$ mount
/dev/disk0s2 on / (hfs, local, journaled)
devfs on /dev (devfs, local, nobrowse)
map auto_home on /home (autofs, automounted, nobrowse)
/dev/disk2s2 on /Volumes/VOLUMENAME (hfs, local, journaled)
... then run the HFS checker using that device name
$ sudo fsck_hfs -ld /dev/disk2s2
... and that claimed that the file system was fine.
Back to Google, found the thread at discussions.apple.com which suggested that the problem might be a corrupted journal. His solution was more complicated than I needed because I don't have a hardware failure to contend with, so I tried doing it online.
Turn off journaling with Apple's hidden hfs.util tool:
$ sudo /System/Library/Filesystems/hfs.fs/Contents/Resources/hfs.util \
-N /Volumes/VOLUMENAME
and try Disk Utility again. Lo and behold, now it can unmount. Let it run through the check and it gives the drive the thumbs up. Turn journaling back on:
And we are back in business. No idea why the journal went bad, and I'll make sure my backups of all the stuff on that drive are up to date.
P.S. The crappy fonts and colouring in this post are a function of this wysiwyg editor that blogger.com provides.
P.P.S Less than two weeks later, the same disk has died again but this time with an error that fsck does not seem to be able to fix. Sigh.
and try Disk Utility again. Lo and behold, now it can unmount. Let it run through the check and it gives the drive the thumbs up. Turn journaling back on:
$ sudo /System/Library/Filesystems/hfs.fs/Contents/Resources/hfs.util \
-J /Volumes/VOLUMENAME/
Allocated 229376K for journal file.
P.S. The crappy fonts and colouring in this post are a function of this wysiwyg editor that blogger.com provides.
P.P.S Less than two weeks later, the same disk has died again but this time with an error that fsck does not seem to be able to fix. Sigh.