Date: Tue, 25 Sep 2007 11:50:05 +0400 From: sam <samflanker@gmail.com> To: Don Lewis <truckman@FreeBSD.org> Cc: freebsd-hackers@FreeBSD.org Subject: Re: fsck of large volume with small memory Message-ID: <46F8BDAD.4000309@gmail.com> In-Reply-To: <200709242330.l8ONU0IT008004@gw.catspoiler.org> References: <200709242330.l8ONU0IT008004@gw.catspoiler.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Don Lewis wrote: > On 24 Sep, sam wrote: > > Expect major file system lossage ... > I think this patch could be better, but this should get you going ... > > Index: sbin/fsck_ffs/pass1.c > =================================================================== > RCS file: /home/ncvs/src/sbin/fsck_ffs/pass1.c,v > retrieving revision 1.43 > diff -u -r1.43 pass1.c > --- sbin/fsck_ffs/pass1.c 8 Oct 2004 20:44:47 -0000 1.43 > +++ sbin/fsck_ffs/pass1.c 24 Sep 2007 23:15:22 -0000 > @@ -93,9 +93,29 @@ > inumber = c * sblock.fs_ipg; > setinodebuf(inumber); > getblk(&cgblk, cgtod(&sblock, c), sblock.fs_cgsize); > - if (sblock.fs_magic == FS_UFS2_MAGIC) > + if (sblock.fs_magic == FS_UFS2_MAGIC) { > inosused = cgrp.cg_initediblk; > - else > + if (inosused < 0 || inosused > sblock.fs_ipg) { > + pfatal("CG %d: PREPOSTEROUS NUMBER OF INODES %d (cg_initediblk), ASSUMING %d (fs_ipg)\n", > + c, inosused, sblock.fs_ipg); > + /* > + * The cylinder group block is most likely > + * totally corrupted and will probably > + * fail the magic number check below as well. > + * Ignoring cg_initediblk and setting > + * inosused to sblock.fs_ipg will allow > + * a manual fsck to proceed further instead > + * of dying when it attempts to allocate > + * an insane amount of memory to store > + * the inode info for this cylinder group. > + * This may provide enough information > + * to allow the system administrator to > + * do a better job of patching the > + * filesystem with fsdb. > + */ > + inosused = sblock.fs_ipg; > + } > + } else > inosused = sblock.fs_ipg; > if (got_siginfo) { > printf("%s: phase 1: cyl group %d of %d (%d%%)\n", > > > after patching ====================================================== # fsck /dev/aacd0s1f ** /dev/aacd0s1f (NO WRITE) ** Last Mounted on /usr ** Phase 1 - Check Blocks and Sizes CG 124: PREPOSTEROUS NUMBER OF INODES 1668246575 (cg_initediblk), ASSUMING 23552 (fs_ipg) UNEXPECTED SOFT UPDATE INCONSISTENCY ** Phase 2 - Check Pathnames UNALLOCATED I=2732216 OWNER=svn MODE=40755 SIZE=512 MTIME=Sep 4 12:22 2007 DIR=/home/svn UNEXPECTED SOFT UPDATE INCONSISTENCY REMOVE? no UNALLOCATED I=2732189 OWNER=venom MODE=40755 SIZE=512 MTIME=Sep 3 17:16 2007 DIR=/home/venom/svn UNEXPECTED SOFT UPDATE INCONSISTENCY REMOVE? no UNALLOCATED I=2732248 OWNER=root MODE=40755 SIZE=512 MTIME=Sep 14 19:03 2007 DIR=/home/venom/temp/devel/trunk *** DELETE OUTPUT *** ** Phase 3 - Check Connectivity UNREF DIR I=2755667 OWNER=games MODE=40750 SIZE=1536 MTIME=Jul 19 16:45 2007 RECONNECT? no UNREF DIR I=2755600 OWNER=games MODE=40750 SIZE=1024 MTIME=Jul 19 16:45 2007 RECONNECT? no UNREF DIR I=2755628 OWNER=games MODE=40750 SIZE=1536 MTIME=Jul 19 16:45 2007 RECONNECT? no UNREF DIR I=2755584 OWNER=games MODE=40750 SIZE=512 MTIME=Jul 19 16:45 2007 RECONNECT? no ** Phase 4 - Check Reference Counts UNREF FILE I=541705 OWNER=root MODE=100555 SIZE=218296 MTIME=Sep 10 14:51 2007 CLEAR? no UNREF FILE I=541950 OWNER=root MODE=100555 SIZE=37832 MTIME=Sep 10 14:52 2007 CLEAR? no *** DELETE OUTPUT *** UNREF FILE I=4875961 OWNER=root MODE=100444 SIZE=35552 MTIME=Sep 10 14:50 2007 CLEAR? no UNREF FILE I=6312454 OWNER=root MODE=104555 SIZE=15880 MTIME=Sep 10 14:52 2007 CLEAR? no ** Phase 5 - Check Cyl groups CG 116: BAD MAGIC NUMBER UNEXPECTED SOFT UPDATE INCONSISTENCY FREE BLK COUNT(S) WRONG IN SUPERBLK SALVAGE? no SUMMARY INFORMATION BAD SALVAGE? no BLK(S) MISSING IN BIT MAPS SALVAGE? no CG 124: BAD MAGIC NUMBER UNEXPECTED SOFT UPDATE INCONSISTENCY LOST 74 DIRECTORIES UNEXPECTED SOFT UPDATE INCONSISTENCY fsck: /dev/aacd0s1f: Segmentation fault: 11 # ====================================================== /Vladimir Ermakov
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?46F8BDAD.4000309>