From Winston@21:1/5 to All on Fri Apr 8 12:09:18 2022
I accidentally unplugged a USB flash drive without first unmounting it.
The file partition had a UFS2 fs.
Before discovering that mistake, I had mounted and unmounted other
flash drives on the same mount point.
When I saw that /mnt still claimed to have a fs mounted, I figured out
which flash drive it had been, and plugged it back in.
Not surprisingly, umount didn't seem to care that the drive had been
plugged back in, and did a forcible unmount.
Attempting to mount the partition failed (as expected), saying unclean,
run fsck. fsck just gave a quick error that implied the fs was no
longer usable. fsck_ffs and fsck_ufs tried harder, but reported a flood
of problems (mostly INODE CHECK-HASH FAILED, but earlier ones reported
problems with the cylinder group, superblock, etc.) at terminal speed
before I ^C'd it. Since the drive was just a backup copy of something
else, I newfs'ed it, and the drive now works again.
* Was there anything I could have done to re-associate the drive with
the mount point?
* I'm a bit surprised that failing to umount would leave the fs in such
bad shape. In case the drive had had something important on it, is
there a better way than fsck* to fix a UFS2 fs that was detached
without umount'ing, or is the only solution to let fsck do its thing
and hope that the file(s) are still there when it's finished?