fsck not working on messed-up file system

Thomas Mueller mueller23 at insightbb.com
Wed Sep 19 10:05:08 UTC 2012


I have or had a problem with a file system (FreeBSD UFS2) messed up, either by errant software or system freeze/crash.

I successfully cross-compiled, from FreeBSD 9.0-STABLE, a NetBSD 5.1_STABLE i386 system to install on 8 GB USB stick.

I have both the NetBSD system source as well as pkgsrc and the FreeBSD ports tree on a FreeBSD partition originally used for FreeBSD 9.0-BETA1, hence I use /BETA1 as the mount point.  This partition is /dev/ada0p9 in FreeBSD and /dev/dk6 in NetBSD.

I subsequently built modular-xorg for this NetBSD installation, installating to USB stick but doing the heavy compiling on the hard-drive partition.

NetBSD, especially with X, is rather freeze/crash-prone, meaning file system is not cleanly umounted.

I then tried to cross-compile, from same NetBSD source tree, NetBSD 5.1_STABLE amd64 but was thrown in the debugger (db>), not really knowing what to do there.  Choosing reset did not provide clean file-system unmount.

I had to run "fsck /dev/ada0p9" on the reboot, got unreadable sectors and eventually a prompt to run fsck again.  I did this but got to an infinite loop, where I got the same prompt again to run fsck again, with the same unreadable blocks.

I got the same thing booting a backup installation of FreeBSD 9.0_STABLE amd64 on a USB stick.

I eventually ran with "script" to capture the output onto another USB stick, sorry about all those ASCII 13s at the ends of the lines:

Script started on Wed Sep 19 04:15:02 2012
fsck_ffs /dev/ada0p9
** /dev/ada0p9
** Last Mounted on /BETA1
** Phase 1 - Check Blocks and Sizes

CANNOT READ BLK: 7584192
CONTINUE? [yn] y

THE FOLLOWING DISK SECTORS COULD NOT BE READ: 7584318, 7584319,
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
1475900 files, 4638292 used, 21162419 free (61643 frags, 2637597 blocks, 0.2% fragmentation)

***** FILE SYSTEM STILL DIRTY *****

***** PLEASE RERUN FSCK *****

Script done on Wed Sep 19 04:17:27 2012


Would this indicate a software bug, or is my Western Digital Caviar Green 3 TB hard drive failing?

I booted that USB stick with NetBSD 5.1_STABLE i386, successfully mounted that partition, /dev/dk6 in NetBSD, but got the message about dirty flag.

So I umounted and ran NetBSD fsck_ffs, and after removing some files, mainly in /pkgsrc directory, and salvaging some stuff, got apparent success, and now that file system is again accessible in both NetBSD 5.1_STABLE i386 and FreeBSD 9.0_STABLE amd64.

Now I wonder if the file system is really fixed, with possibly some files in /pkgsrc subdirectories lost, or if the hard drive is starting to fail.

Tom


More information about the freebsd-questions mailing list