Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 May 2001 17:50:47 +0200
From:      Alson van der Meulen <freebsd@alson.linuxfreak.nl>
To:        freebsd-questions@freebsd.org
Subject:   Re: disaster recovery - killed the partition table on my bootdisk
Message-ID:  <20010527175047.G13125@md2.mediadesign.nl>
In-Reply-To: <20010527162223.Z26314@xs4all.nl>; from rene@xs4all.nl on Sun, May 27, 2001 at 04:22:24PM %2B0200
References:  <20010527162223.Z26314@xs4all.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, May 27, 2001 at 04:22:24PM +0200, rene@xs4all.nl wrote:
> I've been a very stupid boy today.  
> 
> I was trying to newfs one of my 9G disks (ad0) and hang it in /etc/fstab. 
> When I applied the 'manual' handbook procedure to this disc, I made a 
> critical error;
> 
> # dd if=/dev/zero of=/dev/rda1 bs=1k count=1
> # disklabel -Brw da1 auto
> # disklabel -e da1               # create the `e' partition
> # newfs -d0 /dev/rda1e
> # mkdir -p /1
> # vi /etc/fstab               # add an entry for /dev/da1e
> # mount /1
> 
> when I ran commands 1-3 on my da0 (boot)disk!
> 
> It gave me a warning error on the second disklabel command, which kinda 
> made me go 'whoops; shouldnt be doing this on this disc'. I then (scared) 
> proceeded to use /stand/sysinstall to newfs the ad0 disk. 
> 
> When I rebooted, however, my system wouldn't come online anymore. (yeah, 
> yeah, surprise, surprise ;)..... unhapiness.
> 
> I have grabbed my original 4.2-Release bootCD, and am able to use that to 
> view the installation menu. When viewing the disklabel for my da0 disk, I 
> see that there are no partitions and/or slices.
> 
> My question is very simple; can I still resque the data on my da0 disk, 
> and if so, how? I know the approximate layout of my disk; it was
> 
> 300M for /
> 1500M for /usr
> 200M for /var
> 
> but ofcourse, I am probably forgetting how much /swap I had ;(((
have a look at gpart, it can guess your partition table, dunno if it
can reconstruct disklabels. i used it once to reconstruct the primary
partition table of a disk. i'm afraid it can't reconstruct your
disklabel though... you can at least try it. to reconstruct it, it's
most easy to but the hd in another box that can boot some *bsd thing
(or some other os that can run gpart, like linux). if you don't have
another box, you could try to install freebsd from scratch on a
different disk. gpart is in the ports collection. you might also wanna
look at ffsrecover (in ports) for recovering stuff from ufs
partittions. you might be able to reconstruct your disklabel by
creating an entry for the first fs, spanning the whole label. if you
mount it, you might be able to see the size using df. then try
resizing it around that size, 'till you find the second fs.

this will be difficult with a swap partition.

if your data is plain ascii, just open it in vi in read-only mode (vi
/dev/ad0c), and search for the stuff you want, then save it to a file
on an other disk. this only works for small amounts of plain ascii
data though... 

maybe there are some tools around that can search for ufs superblocks,
gpart might be able to do it...

Alson

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




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