unexpected soft update inconsistency - cannot fix

Julian H. Stacey jhs at berklix.com
Tue Jan 10 21:47:23 UTC 2012


Hi Kirk 
cc fs@

Kirk McKusick wrote:
> The problem is that you somehow lost your ".." entry in the
> directory associated with inode 825575. That entry was then
> replaced by "Makefile,v". Because ".." is missing, fsck cannot
> figure out its parent and hence the pathname of the directory.
> 
> To fix, do the following:
> 
> cd to mountpoint of filesystem
> find . -inum 825575 -print
> cd to the directory identified by find
> mv Makefile,v Makefile,v.sav
> cd /
> unmount filesystem
> run fsck which should now be able to create ".."
> mount filesystem
> cd to affected directory
> mv Makefile,v.sav Makefile,v
> 
> 	Kirk McKusick

Thanks ! Meantime I'd been looking & made notes below.
I don't understand how the above  "mv Makefile,v Makefile,v.sav"
would create a new slot ? wouldnt' it just call rename(2) ?
So there'd still be no slot to re-label as ".." to point at parent inode ?
Wouldn't it be better to call fsdb + "ln 79302719 .." as below ?

Also as notes below show inode of parent can be deduced,
wouldn't it be good if such functionality were built into fsck or fsdb code
(or pro tem added as an example to man fsdb ?)

	---------
	fsdb -r /dev/ad4s4g
		** /dev/ad4s4g (NO WRITE)
		Examining file system `/dev/ad4s4g'
		Last Mounted on 
		current inode: directory
		I=2 MODE=40755 SIZE=512
		OWNER=root GRP=wheel LINKCNT=9 FLAGS=0 BLKCNT=4 GEN=359f3dd1
	fsdb (inum: 2)> inode 825575
		current inode: directory
		I=825575 MODE=40755 SIZE=512
		OWNER=mailnull GRP=mailnull LINKCNT=2 FLAGS=0 BLKCNT=4 GEN=29c28025
	fsdb (inum: 825575)> ls
		slot 0 ino 825575 reclen 20: directory, `.'
		slot 1 ino 825580 reclen 20: regular, `Makefile,v'
		slot 2 ino 825581 reclen 20: regular, `distinfo,v'
		slot 3 ino 825582 reclen 20: regular, `pkg-descr,v'
		slot 4 ino 825583 reclen 432: regular, `pkg-plist,v'
	fsdb (inum: 825575)> print
		current inode: directory
		I=825575 MODE=40755 SIZE=512
		OWNER=mailnull GRP=mailnull LINKCNT=2 FLAGS=0 BLKCNT=4 GEN=29c28025
	# LINKCNT=2 seems wrong, comparing with a goo directory,
	# I think should be 4 without the ".." & 5 with "..".
	fsdb (inum: 825575)> uplink
		fsdb: `uplink' requires write access
		fsdb: rval was 1
		fsdb (inum: 825575)> 
	To Do Later With Fsdb ( without -r )
		uplink
		uplink
		ln 79302719 ..

	mount /usr1 ; mount | grep /usr1
		/dev/ad4s4g on /usr1 (ufs, local, read-only)
	cd /usr1 ; find -x . -inum 825575
		./ftp/.backup/pri/FreeBSD/development/FreeBSD-CVS/\
		ports/net/keepalived/Attic
	cd ftp/.backup/pri/FreeBSD/development/FreeBSD-CVS/ports/net/keepalived
	ls -lai
		total 50
		79302719 drwxr-xr-x     3 mailnull  mailnull    512 Dec 29 20:09 ./
		73700289 drwxr-xr-x  2109 mailnull  mailnull  43520 Dec 29 20:08 ../
		  825575 drwxr-xr-x     2 mailnull  mailnull    512 Dec 29 22:12 Attic/
		79302722 drwxr-xr-x     3 mailnull  mailnull    512 Dec 29 22:12 files/

	fsdb (inum: 825575)> inode 79302719
		current inode: directory
		I=79302719 MODE=40755 SIZE=512
		OWNER=mailnull GRP=mailnull LINKCNT=3 FLAGS=0 BLKCNT=4 GEN=293a450d
	fsdb (inum: 79302719)> ls
		slot 0 ino 79302719 reclen 12: directory, `.'
		slot 1 ino 73700289 reclen 12: directory, `..'
		slot 2 ino 79302722 reclen 16: directory, `files'
		slot 3 ino 825575 reclen 472: directory, `Attic'
	---------

Cheers,
Julian
-- 
Julian Stacey, BSD Unix Linux C Sys Eng Consultants Munich http://berklix.com
 Reply below not above, cumulative like a play script, & indent with "> ".
 Format: Plain text. Not HTML, multipart/alternative, base64, quoted-printable.


More information about the freebsd-fs mailing list