Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Apr 2003 18:01:21 -0700
From:      Joshua Oreman <oremanj@webserver.get-linux.org>
To:        David David <ddavid_3@yahoo.com>
Cc:        questions@freebsd.org
Subject:   Re: MBR, Partition File recover
Message-ID:  <20030416010121.GB61362@webserver.get-linux.org>
In-Reply-To: <20030416004744.20978.qmail@web11303.mail.yahoo.com>
References:  <20030416004744.20978.qmail@web11303.mail.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Apr 15, 2003 at 08:47:44PM -0400 or thereabouts, David David seemed to write:
> 
> Hello,
> 
> Through a series of very stupid actions i did today i have very
> successfully blown a giant hole in my foot. Hopefully i can make this
> as short as possible.
> 
> The short of it is, i had FreeBSD 4.7, Gentoo Linux and WinXP
> installed on my system and was going to do a complete re-install of
> FreeBSD and Gentoo. I backed up all my files from my drive's into
> .bz2 files, and placed them in a folder of one of my FreeBSD
> partitions.
> 
> I also had turned a spare drive into a storage drive formatted ext2
> which i copied al the files into as added bonus. So while
> re0installing Gentoo first, one of the steps in the Install doc was
> to dd the mbr of the drive's you wanted to use, here's what i did to
> the drive's:
> 
> dd if=/dev/zero of=/dev/hda bs=1k count=1, etc for the other drive's
> i was going to use. 
> 
> Unfortunately while sleeping i also did this to the drive that had my
> backup files on my FreeBSD partition, also due too some more
> airheaded-ness i managed to fsck up the spare drive ext2 file system
> leaving me at present, looking around the net for a way of recovering
> those files, either from the ext2fs or the FreeBSD file system.
> 
> So i was wandering if some kind soul out there could possibly suggest
> some action's ( besides jumping from a bridge, which i have finally
> ruled out for the moment) that i might take to either restore the 1k
> or mbr if that's what i deleted, or of a way of recovering those
> file's of that drive?
> 
> One note, since i did the "dd" above i have not touched the drive in
> question in any way, it's the same as when i re-booted out of FreeBSD
> minus that 1k.
> 

I assume you have a spare FBSD machine (any version). If not, connect the
dead drive to a friend's PC.
Install /usr/ports/sysutils/gpart.

*** In the following I assume the trashed FBSD disk is /dev/ad0 ***

Usage:
	To find partitions:
		gpart /dev/ad0
	If that fails, try this (takes *really* long):
		gpart -f /dev/ad0
		If it works and the preceeding doesn't, use the -f option
		in all calls to gpart for that disk.
	Then, when you're satisfied, to write it:
		gpart -i -W /dev/ad0 /dev/ad0
	If you want to backup the existing MBR before write:
		gpart -b /root/backup.dev_ad0.mbr -i -W /dev/ad0 /dev/ad0
	If you are sure about these partitions and don't want confirmation
	for writing them:
		Drop the -i option.
	To write to a file:
		Replace '-W /dev/ad0' with '-W /root/new.dev_ad0.mbr'

I hope this helps!

-- Josh

[snip]
> 
> Thanks!
> 
> David
> 
> PS: Please CC me ddavid_3@yahoo.com
> 
> 
> ______________________________________________________________________ 
> Post your free ad now! http://per0sonals.yahoo.ca
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"



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