From owner-freebsd-questions@FreeBSD.ORG Sun Jan 23 05:20:10 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7971B106566B for ; Sun, 23 Jan 2011 05:20:10 +0000 (UTC) (envelope-from bennett@cs.niu.edu) Received: from mp.cs.niu.edu (mp.cs.niu.edu [131.156.145.41]) by mx1.freebsd.org (Postfix) with ESMTP id 32F5C8FC14 for ; Sun, 23 Jan 2011 05:20:09 +0000 (UTC) Received: from mp.cs.niu.edu (bennett@localhost [127.0.0.1]) by mp.cs.niu.edu (8.14.3/8.14.3) with ESMTP id p0N4M1IO012455 for ; Sat, 22 Jan 2011 22:22:01 -0600 (CST) Date: Sat, 22 Jan 2011 22:22:01 -0600 (CST) From: Scott Bennett Message-Id: <201101230422.p0N4M14G012454@mp.cs.niu.edu> To: freebsd-questions@freebsd.org Subject: Re: help requested in fixing disk label mistake X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jan 2011 05:20:10 -0000 I just wrote: > A couple of days ago, I reorganized the internal hard drive of my machine >to reclaim space that used to be occupied by another operating system for use >with my now exclusively FreeBSD system. I used a stand-alone partition manager >to edit the slices down to just two slices. I then attempted to bsdlabel the >first slice, but made a bit of a slip. When I should have typed > > bsdlabel -w ad0s1 > >I actually typed > > bsdlabel -w da0s1 > >Oops. > I went ahead with the work on the internal drive (ad0), and the system >is up and running fine. Now I'd like to try to fix the damage done to the >external drive that I relabeled by mistake. That drive's layout before the >damage was done was a single slice, divided into two partitions (da0s1 and ^^^^^ >da0s2), each of which was then glabel'ed. The moment I rewrote the bsdlabel ^^^^^ Yet another pair of mistakes on my part. Those should have said da0s1d and da0s1e. Sorry for any confusion. >for the first slice by mistake, the two partitions' entries in /dev/label >vanished, of course. I checked and discovered that the only external drive >for which I had not kept backup copies of the bsdlabel information was that >drive. :-( Fortunately, the full backups of the file systems that I needed >to reload onto the internal drive were in the first partition of the external >drive in question (used to be s1d, now s1a for the time being), so by mounting >/dev/da0s1a I still had full access to the file system containing the backups. > My hypothesis is if I can somehow rewrite a correct bsdlabel for the >affected slice, that the system will then recognize the glabel metadata for >the two partitions immediately, and the /dev/label entries will appear right >away like magic. Unfortunately, without a backup file of the bsdlabel >information, I'm unsure how to accomplish that. Is there some way that I can >discover the exact size in sectors of the first partition, so that I could >edit the bsdlabel information and redefine it as two partitions of the correct >sizes and offsets? Is there some field in dumpfs(8) output that would give me >what I need (allowing, of course, for the fact that the first partition >is actually one sector longer than anything dumpfs(8) would know about due to >the glabel metadata in the final sector of the partition)? Or is my hypothesis >stated above actually incorrect, and if so, why/how? > PLEASE send any replies to ME DIRECTLY (or at least Cc: me directly) >because I receive this list in digest form and am at least a week and a half >behind on my reading. :-} Thanks much in advance for any helpful ideas. Scott Bennett, Comm. ASMELG, CFIAG ********************************************************************** * Internet: bennett at cs.niu.edu * *--------------------------------------------------------------------* * "A well regulated and disciplined militia, is at all times a good * * objection to the introduction of that bane of all free governments * * -- a standing army." * * -- Gov. John Hancock, New York Journal, 28 January 1790 * **********************************************************************