Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Aug 1998 20:50:44 +0200
From:      Stefan Eggers <seggers@semyam.dinoco.de>
To:        Mikhail Teterin <mi@video-collage.com>
Cc:        current@FreeBSD.ORG, seggers@semyam.dinoco.de
Subject:   Re: recovering disk 
Message-ID:  <199808261850.UAA19508@semyam.dinoco.de>
In-Reply-To: Your message of "Wed, 26 Aug 1998 14:03:54 EDT." <199808261803.OAA08562@xxx.video-collage.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
> I'm wondering, if I can write a program which will:
> 	1) read /dev/rsd1 to
> 	2) find the beginning of the file-system partition and

I did something similar on my brother's machine.  Somehow it looked as
if the Windows FAT partition overlapped the FreeBSD slice following it
and overwrote it one some operation.  Anyway, the disklabel was erased
and no backup copy in any form of it was available.

Thus I wrote a small programm which opened the slice and read every 8
KByte block (the block size of the filesystem's used) and checked them
for being a superblock.  I did the same for the cylinder group headers
next to them.  This is trivial to do.  The comments in /usr/include/
ufs/ffs/fs.h should lead the way the the right information in there
with a little bit of understanding how the filesystem is organized.

This information I collected on paper and made my own conclusions from
the contents of the superblock and the numbers and starts of the
cylinder groups of where the filesystems itself starts.  If you have
two superblocks 8 KByte apart from each other (so being neighbours)
the first one is 8 KByte from the start of the filesystem and the
other one 16 KByte.  That's the trivial case.

I think one can do this with a program quite easily but I had neither
time for debugging one nor did I want to trust any on this.  Needless
to say there were no current backup of the filesystems so a program
giving bad numbers would have been fatal.

> 	3) write it out (all the way to the end) as a separate file, which

Given you have the start and the probably size dd will do the rest if
used on the slice.

> 	4) vn-mechanism will let me access and get to my files
> ?

Left as an exercise to the reader.  I'd expect that to work w/o any
surprises.

> I'm quite sure my data is intact on the disk and it is only its beginning tha
t's
> hosed. Thanks in advance for your ideas and suggestions. Yours,

If the start including first superblock is damaged you'll of course
have to use fsck with one of the many alternative superblocks whose
position you get if you do it the way I recovered the disklabel or
have noted when you newfs'ed the filesystem.

Stefan.
-- 
Stefan Eggers                 Lu4 yao2 zhi1 ma3 li4,
Max-Slevogt-Str. 1            ri4 jiu3 jian4 ren2 xin1.
51109 Koeln
Federal Republic of Germany

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



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