MBR, Partition File recover

root root at webserver.get-linux.org
Tue Apr 15 18:27:28 PDT 2003


[Please keep on list.]

On Tue, Apr 15, 2003 at 09:19:40PM -0400 or thereabouts, David David seemed to write:
>  --- Joshua Oreman <oremanj at webserver.get-linux.org> wrote: > On Tue,
> Apr 15, 2003 at 08:47:44PM -0400 or thereabouts, David
> > > 
> > 
> > I assume you have a spare FBSD machine (any version). If not,
> > connect the
> > dead drive to a friend's PC.
> 
> I have 5 drive's in this box so i'm going to re-install FreeBSD to
> one drive. ( Continued below)
> 
> > 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
> > 
> 
> Before i do this, is there a way of making a complete copy of the
> drive first? I can store it on another drive in the system. I've been
> going through dd man page, and searching on the net, but have not yet
> found a way of doing.
> 
> Side Note: By making a copy i'm assuming if i mess this up i will be
> able too just put the copy back on the drive and try again?

Gpart only touches the first 1k of the disk (exactly what you lost :-)

See the gpart man page.

TO BACKUP:
dd if=/dev/ad0 bs=1k count=1 of=/some/file/on/other/drive.mbr
TO RESTORE:
dd if=/some/file/on/other/drive.mbr of=/dev/ad0 bs=1k count=1

> 
> Thanks Josh
> 
> David
>  
> 
> ______________________________________________________________________ 
> Post your free ad now! http://personals.yahoo.ca


More information about the freebsd-questions mailing list