Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Jun 2005 19:13:54 -0700 (PDT)
From:      Don Lewis <truckman@FreeBSD.org>
To:        anderson@centtech.com
Cc:        hackers@FreeBSD.org
Subject:   Re: problem with file system
Message-ID:  <200506020213.j522DswH002222@gw.catspoiler.org>
In-Reply-To: <429E21E7.2000501@centtech.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On  1 Jun, Eric Anderson wrote:
> GiZmen wrote:
>> Hi,
>> 
>> Recently my box had a power failure and after reboot when
>> i wanted to check my encrypted filesystem with fsck i 
>> have that message:
>> 
>> # fsck /dev/ad0s1g.bde
>> ** /dev/ad0s1g.bde (NO WRITE)
>> ** Last Mounted on /crypto
>> ** Phase 1 - Check Blocks and Sizes
>>  fsck_ufs: cannot alloc 2129430592 bytes for inoinfo
>> 
>> or:
>> 
>> # fsck_ffs -p /dev/ad0s1g.bde
>> /dev/ad0s1g.bde: NO WRITE ACCESS
>> /dev/ad0s1g.bde: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
>> 
>> 
>> i know that i have no write access but this file system is 
>> mounted right now and it seems that everything is ok.
>> I have tried to repair this when this file system was unmounted
>> but i had the same errors.
>> 
>> I don't know how to repair this file system. Could anyone point me
>> what to do?
> 
> I'm struggling with the same problem.  Suggestion so far from Don Lewis:
> 
> Try setting kern.maxdsiz to a larger value in /boot/loader.conf and
> rebooting.  I've got mine set to 1GB.
> 	kern.maxdsiz="1073741824"
> 
> This didn't do it for me, but it might work for you.

I suspect this is a different problem.  In your case fsck_ufs was trying
to allocate a sane amount of memory, so my best guess was that your file
system was sufficiently large that you were running into the kernel
enforced datasize limit.  Run "limit" in your shell to double check that
the datasize limit increased.

In this case

>>  fsck_ufs: cannot alloc 2129430592 bytes for inoinfo

tells me that the power failure likely corrupted one of the cylinder
group blocks.  Here's my suggestion on how to fix this:

At line 92 in src/sbin/fsck_ffs/pass1.c, you should see the following
block of code:

        for (c = 0; c < sblock.fs_ncg; c++) {
                inumber = c * sblock.fs_ipg;
                setinodebuf(inumber);
                getblk(&cgblk, cgtod(&sblock, c), sblock.fs_cgsize);
                if (sblock.fs_magic == FS_UFS2_MAGIC)
                        inosused = cgrp.cg_initediblk;
                else
                        inosused = sblock.fs_ipg;

Try changing
	inosused = cgrp.cg_initediblk;
to
	inosused = (cgrp.cg_initediblk <= sblock.fs_ipg &&
            cgrp.cg_initediblk > 0) ? cgrp.cg_initediblk :
            sblock.fs_ipg;

Be prepared for the possibilty of a lot of file system damage.  You
might see a lot of files that claim the same blocks, and a lot of stuff
could end up in lost+found.  I recommend buying an UPS and installing
one of the UPS utilities from ports that does a clean shutdown before
the battery runs down.

At some point, I'd like to commit a proper fix to fsck, but that's a
little more involved and my day job is keeping me way too busy.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200506020213.j522DswH002222>