Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Dec 2003 08:24:16 -0800 (PST)
From:      "Scott I. Remick" <scott@sremick.net>
To:        FreeBSD <freebsd-questions@freebsd.org>
Subject:   Re: "Cannot find file system superblock" error - how to recover?
Message-ID:  <20031204162416.81350.qmail@web41103.mail.yahoo.com>
In-Reply-To: <20031204180352.7c4e7571.doublef@tele-kom.ru>

next in thread | previous in thread | raw e-mail | index | archive | help

--- Sergey 'DoubleF' Zaharchenko <doublef@tele-kom.ru> wrote:
> If you want to be more sure, try dd'ing your (suspectedly damaged)
> superblock and some of its (suspectedly OK) copies into different files:
> 
> # dd if=/dev/ad6s1e skip=... bs=512 count=16 of=somefile
> 
> As /usr/src/sys/ufs/ffs/fs.h suggests, for THE superblock skip should be
> 16 if you have UFS1 or 128 or 512 if you have UFS2 (if my maths is
> correct). These commands shouldn't do anything harmful to /dev/ad6s1e.

Either I'm doing something wrong, or things aren't good.

Given:

su-2.05b# newfs -N /dev/ad6s1e
/dev/ad6s1e: 76340.1MB (156344516 sectors) block size 16384, fragment size
2048
        using 416 cylinder groups of 183.77MB, 11761 blks, 23552 inodes.
super-block backups (for fsck -b #) at:
 160, 376512, 752864, 1129216, 1505568, 1881920, 2258272, 2634624, 3010976,

...

 152046368, 152422720, 152799072, 153175424, 153551776, 153928128,
154304480,
 154680832, 155057184, 155433536, 155809888, 156186240

I take 6 superblock copies (3 from beginning, 3 from end):

su-2.05b# dd if=/dev/ad6s1e skip=160 bs=512 count=16 of=sb1
16+0 records in
16+0 records out
8192 bytes transferred in 0.026774 secs (305969 bytes/sec)
su-2.05b# dd if=/dev/ad6s1e skip=376512 bs=512 count=16 of=sb2
16+0 records in
16+0 records out
8192 bytes transferred in 0.008415 secs (973502 bytes/sec)
su-2.05b# dd if=/dev/ad6s1e skip=752864 bs=512 count=16 of=sb3
16+0 records in
16+0 records out
8192 bytes transferred in 0.006808 secs (1203283 bytes/sec)
su-2.05b# dd if=/dev/ad6s1e skip=155433536 bs=512 count=16 of=sb4
16+0 records in
16+0 records out
8192 bytes transferred in 0.023173 secs (353513 bytes/sec)
su-2.05b# dd if=/dev/ad6s1e skip=155809888 bs=512 count=16 of=sb5
16+0 records in
16+0 records out
8192 bytes transferred in 0.011078 secs (739484 bytes/sec)
su-2.05b# dd if=/dev/ad6s1e skip=156186240 bs=512 count=16 of=sb6
16+0 records in
16+0 records out
8192 bytes transferred in 0.010837 secs (755932 bytes/sec)

None of these are the same:

su-2.05b# cmp sb1 sb2
sb1 sb2 differ: char 1, line 1
su-2.05b# cmp sb1 sb3
sb1 sb3 differ: char 1, line 1
su-2.05b# cmp sb2 sb3
sb2 sb3 differ: char 1, line 1

I don't include sb4-6 here because they're all null:

su-2.05b# hexdump -C sb4
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 
|................|
*
00002000
su-2.05b# hexdump -C sb5
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 
|................|
*
00002000
su-2.05b# hexdump -C sb6
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 
|................|
*
00002000

I am suspecting there is something wrong in my syntax for fetching the
superblocks. I see that the SB size is always 8192 bytes regardless so it
should be 512*16 as in the dd command. And I checked that the #s output by
newfs -N were block positions and not raw byte permissions.

However newfs -N is saying that it is reporting the positions using a
blocksize of 16384. In which case, 160 would mean 160 * 16384 = 2621440
(byte pos). To translate to the 512-byte blocks, this means the skip should
be 5120 (and 12048384 and 24091648 respectively for the 2nd & 3rd sb
positions). However, when I grab 8192-byte chunks using these skip settings
w/ dd, they don't match up either. I was hoping I was onto something. :(

Yet you say using the same # output by newfs -N as the skip for dd worked
for you... hmm.



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