Root filesystem corrupted. Upgrade or reinstall?

Yesterday, for the first time since I started with FreeBSD back when it was v1.something, I hung a system (my server!!) so completely that I had to deadstart.

By the look of it, in trying to move some files around to free up some space I didn't do my sums right and mv may have tried to write past the end of the disc. That's only a guess, but when I rebooted I found that part of the root filesystem was fragmented grossly corrupted and nonsensical, with bits of files and subtrees all over the place. Realistically there's probably no chance of piecing them back together in less than geologic time, though most of them from their last-mod date were system files.

I don't know how much functionality is left, so my question might be moot: should I try to do an upgrade over the net in hope of salvaging as much as possible, or just bite the proverbial bullet and reinstall from an iso?
 
mv may have tried to write past the end of the disc.
It can't so this will never happen. You just fill up a filesystem and the move gets aborted at some point. But, if it was a move, within the same filesystem, no data actually gets moved around, only the file pointers are changed. A move within the same filesystem therefor can't fill up your disk. A move between two filesystems is basically a copy followed by a delete. This could fill up the destination because you're copying the data.

That's only a guess, but when I rebooted I found that part of the root filesystem was fragmented and nonsensical, with bits of files and subtrees all over the place.
That's not fragmentation, that's a corrupt filesystem. Fragmentation happens on disks when they're nearly full. Most of the time the system tries to write a file to consecutive blocks. Fragmentation occurs when there aren't enough consecutive blocks and it needs to find other free blocks spread all over the disk. Because the blocks all now all over the disk the drive needs to "seek" (i.e. move the disk heads) a lot more to read all the blocks of data. Due to the additional seeking loading takes longer. So this is fairly bad for performance but nothing more than that. (SSDs don't have this problem because they always have 0 seek times, regardless of how fragmented the disk is.)

What you are describing sounds more like a corrupted filesystem. Pointers to directories are messed up, pointers to files are lost, that sort of thing.

I don't know how much functionality is left, so my question might be moot: should I try to do an upgrade over the net in hope of salvaging as much as possible, or just bite the proverbial bullet and reinstall from an iso?
If it's this corrupted you're probably better off doing a clean reinstall. You can try to fix the filesystem with fsck(8) but that might be more destructive than helpful. I had a disk once with a filesystem problem and an fsck(8) fixed it, but all files where dropped in lost+found. Filesystem was nice and clean afterwards, but all my files were pretty much gone too.
 
When I think about how thoroughly that part of the disc map seems to have been disintegrated, I bet it would end up the same as yours did: all the bits piled in a heap in lost+found. *sigh* I'l pick through the rubble, save whatever is savable, and then do the reinstall.
 
Back
Top