Subject: Re: /var CORRUPTED : remote fix ?
To: None <netbsd-users@NetBSD.org>
From: Mike Parson <mparson@bl.org>
List: netbsd-users
Date: 07/12/2005 10:38:25
On Tue, Jul 12, 2005 at 06:52:27PM +1200, Asmodehn Shade wrote:
> Hi all,
> 
> I just had a weird network problem on a remote server, and after all
> the update I have done, my var got corrupted. Here is the "fsck -f
> /var" result :
> 
> ** /dev/rsd0f (NO WRITE)
> ** Last Mounted on /var
> ** Phase 1 - Check Blocks and Sizes
> INCORRECT BLOCK COUNT I=12103 (2 should be 0)
> CORRECT? no
> 
> INCORRECT BLOCK COUNT I=12229 (2 should be 0)
> CORRECT? no
> 
> INCORRECT BLOCK COUNT I=12276 (2 should be 0)
> CORRECT? no
> 
> ** Phase 2 - Check Pathnames
> ** Phase 3 - Check Connectivity
> ** Phase 4 - Check Reference Counts
> ** Phase 5 - Check Cyl groups
> FREE BLK COUNT(S) WRONG IN SUPERBLK
> SALVAGE? no
> 
> SUMMARY INFORMATION BAD
> SALVAGE? no
> 
> BLK(S) MISSING IN BIT MAPS
> SALVAGE? no
> 
> 2793 files, 42878 used, 21890 free (346 frags, 2693 blocks, 0.5% fragmentation)
> 
> How can I fix that remotely (ssh) ? This computer is overseas, and
> there is no way for me to get there and use the single user mode...
> 
> While /var is mounted I am unable to fix it as fsck access only to
> /dev/rsd0f which is read only. And when I try to unmount /var my
> systems hangs, and I have to get someone overseas to push the power
> button... and the raw reboot doesn't seem to fix that..
> 
> Please help! I don't really know what to do...

A variation on the last post on this...

Edit /etc/fstab, comment out your /var entry, reboot.  Might want to
edit /etc/rc.conf, set things that want /var to contain stuff
(named, sendmail, etc) to not start.

Things will probably complain while booting since the dir-tree expected
under /var won't be there.  Might require manual intervention to finish
booting, dunno, never tried this approach before.

Properly fsck /dev/rds0f, maybe mount it manually under /mnt, check it
for consistancy.

Fix /etc/fstab and rc.conf and reboot.

*or*

Talk someone through a manual single-user boot and fsck.  I've had to
talk several night-shift computer-illiterates through such procedures
before.  It can suck, but it can usually be done.

-- 
Michael Parson
mparson@bl.org