Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Apr 2003 18:27:36 -0700
From:      root <root@webserver.get-linux.org>
To:        David David <ddavid_3@yahoo.com>
Cc:        questions@freebsd.org
Subject:   Re: MBR, Partition File recover
Message-ID:  <20030416012736.GA62320@webserver.get-linux.org>
In-Reply-To: <20030416011940.27587.qmail@web11307.mail.yahoo.com>
References:  <20030416010121.GB61362@webserver.get-linux.org> <20030416011940.27587.qmail@web11307.mail.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
[Please keep on list.]

On Tue, Apr 15, 2003 at 09:19:40PM -0400 or thereabouts, David David seemed to write:
>  --- Joshua Oreman <oremanj@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



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