From owner-freebsd-questions@FreeBSD.ORG Thu Dec 4 08:24:18 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1F9BB16A4CE for ; Thu, 4 Dec 2003 08:24:18 -0800 (PST) Received: from web41103.mail.yahoo.com (web41103.mail.yahoo.com [66.218.93.19]) by mx1.FreeBSD.org (Postfix) with SMTP id ECB0843F93 for ; Thu, 4 Dec 2003 08:24:16 -0800 (PST) (envelope-from scott@sremick.net) Message-ID: <20031204162416.81350.qmail@web41103.mail.yahoo.com> Received: from [199.172.45.60] by web41103.mail.yahoo.com via HTTP; Thu, 04 Dec 2003 08:24:16 PST X-RocketYMMF: siremick Date: Thu, 4 Dec 2003 08:24:16 -0800 (PST) From: "Scott I. Remick" To: FreeBSD In-Reply-To: <20031204180352.7c4e7571.doublef@tele-kom.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: "Cannot find file system superblock" error - how to recover? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: scott@sremick.net List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Dec 2003 16:24:18 -0000 --- Sergey 'DoubleF' Zaharchenko 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.