Unfixable UFS2 corruption

Eugene Grosbein egrosbein at rdtc.ru
Wed Aug 31 16:24:11 UTC 2011


31.08.2011 23:13, Eugene Grosbein пишет:
> 31.08.2011 23:02, Adam Vande More пишет:
> 
>>     Long story short: my /usr/local UFS2 filesystem somehow got corrupted
>>     and "fsck -y" in single user mode does not fix it.
>>
>> Not sure if this helps or not but on rare occasion I've had to run fsck twice consecutively to fix a FS.
> 
> Not this time - fsck does NOT find any problems in this file system.
> 
> Now I think fsck_ffs needs a patch:
> 
> --- sbin/fsck_ffs/dir.c.orig	2011-08-31 22:54:23.000000000 +0700
> +++ sbin/fsck_ffs/dir.c	2011-08-31 22:54:48.000000000 +0700
> @@ -225,7 +225,7 @@
>  	type = dp->d_type;
>  	if (dp->d_reclen < size ||
>  	    idesc->id_filesize < size ||
> -	    namlen > MAXNAMLEN ||
> +	    namlen == 0 || namlen > MAXNAMLEN ||
>  	    type > 15)
>  		goto bad;
>  	for (cp = dp->d_name, size = 0; size < namlen; size++)
> 
> 
> Comments?

With this patch applied, my FS has finally been fixed by fsck:

** Last Mounted on /usr/local
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
DIRECTORY CORRUPTED  I=1531227  OWNER=root MODE=40755
SIZE=4608 MTIME=Aug 30 01:28 2011 
DIR=/obj/usr/local/src/secure/lib/libssh

SALVAGE? [yn] 

** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
LINK COUNT FILE I=24  OWNER=root MODE=100644
SIZE=892 MTIME=Sep 17 11:10 2010  COUNT 2 SHOULD BE 1
ADJUST? [yn] 

** Phase 5 - Check Cyl groups
459580 files, 7411823 used, 7819495 free (105503 frags, 964249 blocks, 0.7% fragmentation)

***** FILE SYSTEM IS CLEAN *****

***** FILE SYSTEM WAS MODIFIED *****

Should I fill PR?

Eugene Grosbein


More information about the freebsd-stable mailing list