From owner-freebsd-questions@FreeBSD.ORG Tue Apr 15 18:27:27 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E12EC37B401 for ; Tue, 15 Apr 2003 18:27:27 -0700 (PDT) Received: from www.get-linux.org (adsl-64-161-78-226.dsl.lsan03.pacbell.net [64.161.78.226]) by mx1.FreeBSD.org (Postfix) with SMTP id DBE0743FAF for ; Tue, 15 Apr 2003 18:27:26 -0700 (PDT) (envelope-from root@www.get-linux.org) Received: (qmail 62337 invoked by uid 0); 16 Apr 2003 01:27:36 -0000 Date: Tue, 15 Apr 2003 18:27:36 -0700 From: root To: David David Message-ID: <20030416012736.GA62320@webserver.get-linux.org> References: <20030416010121.GB61362@webserver.get-linux.org> <20030416011940.27587.qmail@web11307.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030416011940.27587.qmail@web11307.mail.yahoo.com> User-Agent: Mutt/1.4i cc: questions@freebsd.org Subject: Re: MBR, Partition File recover X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Apr 2003 01:27:28 -0000 [Please keep on list.] On Tue, Apr 15, 2003 at 09:19:40PM -0400 or thereabouts, David David seemed to write: > --- Joshua Oreman 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