[solved] Re: fsck_ffs not updating standard superblock with alternate superblock

From: ndb <ndb_at_theghet.to>
Date: Tue, 15 Apr 2003 21:03:43 -0400
solved.  hacked fsck_ffs.

/usr/src/sbin/fsck_ffs/fsutil.c

replaced this
        if (havesb && cursnapshot == 0 && sblock.fs_magic == FS_UFS2_MAGIC &&
            sblk.b_bno != sblock.fs_sblockloc / dev_bsize &&
            !preen && reply("UPDATE STANDARD SUPERBLOCK")) {

with this
        if (havesb && cursnapshot == 0 && 
            sblk.b_bno != sblock.fs_sblockloc / dev_bsize &&
            !preen ) {

i got my superblock back.

turns out softupdates was turned on, and i still lost my superblock.

How come fsck_ffs only replaces the superblock on UFS2 file sytems and not UFS1?

ndb


On Tue, Apr 15, 2003 at 10:35:42AM -0400, ndb wrote:
> Summary:  FreeBSD 5.0-RELEASE kernel with the UFS2 filesystem.  
> Power failure caused computer to reboot,  file systems that 
> had soft updates turned on had fsck defer to background fscking when it
> was loading, the last drive on my /etc/fstab file didnt have soft
> updates turned on, and after it fscked the drive and marked it as clean,
> it just hung there.  I booted to single user mode, and commented out
> the line for my drive that didnt have soft updates turned on.  When it
> rebooted, I manually did an fsck with the alternate superblock because
> my standard superblock was corrupted, fsck_ffs never gave me an option
> to copy the alternate superblock to the standard one, I tried some dd
> commands, but it didnt work.  The drive is good, dmesg showed no errors,
> plenty of good superblocks.  If i do get this drive mounted, I'm going
> to turn on soft updates for it.
> 
> Question:  How can I get an alternate superblock to become the standard
> superblock?  Can I mount it using the alternate superblock?
> 
> ndb
> 
> lunchbox# uname -a
> FreeBSD lunchbox.theghet.to 5.0-RELEASE FreeBSD 5.0-RELEASE #0: Sat Feb 15 15:09:53 EST 2003     root_at_lunchbox.theghet.to:/usr/src/sys/i386/compile/THEGHETTO  i386
> lunchbox# fsck_ffs -b 0 /dev/ad3s1d
> Alternate super block location: 0
> ** /dev/ad3s1d
> Cannot find file system superblock
> 
> LOOK FOR ALTERNATE SUPERBLOCKS? [yn] y
> 
> USING ALTERNATE SUPERBLOCK AT 32
> ** Last Mounted on
> ** Phase 1 - Check Blocks and Sizes
> ** Phase 2 - Check Pathnames
> ** Phase 3 - Check Connectivity
> ** Phase 4 - Check Reference Counts
> ** Phase 5 - Check Cyl groups
> 534646 files, 33571978 used, 4883082 free (4298 frags, 609848 blocks, 0.0% fragmentation)
> 
> ***** FILE SYSTEM MARKED CLEAN *****
> lunchbox# newfs -N /dev/ad3s1d
> /dev/ad3s1d: 76316.6MB (156296320 sectors) block size 16384, fragment size 2048
>         using 416 cylinder groups of 183.69MB, 11756 blks, 23552 inodes.
> super-block backups (for fsck -b #) at:
>  32, 376224, 752416, 1128608, 1504800, 1880992, 2257184, 2633376,
> ...
>  91790880, 92167072, 92543264, 92919456, 93295648, 93671840, 
> lunchbox# fsck_ffs -b 93295648 /dev/ad3s1d
> Alternate super block location: 93295648
> ** /dev/ad3s1d
> ** Last Mounted on
> ** Phase 1 - Check Blocks and Sizes
> ** Phase 2 - Check Pathnames
> ** Phase 3 - Check Connectivity
> ** Phase 4 - Check Reference Counts
> ** Phase 5 - Check Cyl groups
> SUMMARY BLK COUNT(S) WRONG IN SUPERBLK
> SALVAGE? [yn] y
> 
> 534646 files, 33571978 used, 4883082 free (4298 frags, 609848 blocks, 0.0% fragmentation)
> 
> ***** FILE SYSTEM WAS MODIFIED *****
> lunchbox# dd if=/dev/ad3s1d bs=16k count=1 skip=32 of=alternatesuperblock
> 1+0 records in
> 1+0 records out
> 16384 bytes transferred in 0.007131 secs (2297542 bytes/sec)
> 
> 
> 
> lunchbox# dd if=/dev/ad3s1d bs=16k count=1 of=standardsuperblock
> 1+0 records in
> 1+0 records out
> 16384 bytes transferred in 0.002671 secs (6134025 bytes/sec)
> lunchbox# dd if=alternatesuperblock bs=16k count=1 of=/dev/ad3s1d
> dd: /dev/ad3s1d: Operation not permitted
> 1+0 records in
> 0+0 records out
> 0 bytes transferred in 0.000541 secs (0 bytes/sec)
> lunchbox# 
> 
> 
> 
> 
> lunchbox# dd if=/dev/ad3s1d bs=16k count=1 skip=33 of=alternatesuperblock
> 1+0 records in
> 1+0 records out
> 16384 bytes transferred in 0.000973 secs (16838882 bytes/sec)
> lunchbox# dd if=/dev/ad3s1d bs=16k count=1 skip=1  of=standardsuperblock
> 1+0 records in
> 1+0 records out
> 16384 bytes transferred in 0.007905 secs (2072611 bytes/sec)
> lunchbox# dd if=alternatesuperblock bs=16k count=1 skip=1 of=/dev/ad3s1d
> 0+0 records in
> 0+0 records out
> 0 bytes transferred in 0.000026 secs (0 bytes/sec)
> lunchbox# 
> 
> 
> _______________________________________________
> freebsd-current_at_freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe_at_freebsd.org"
Received on Tue Apr 15 2003 - 16:28:28 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:03 UTC