From owner-freebsd-questions@FreeBSD.ORG Thu Dec 1 15:09:03 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org 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 0550F16A422 for ; Thu, 1 Dec 2005 15:09:03 +0000 (GMT) (envelope-from illusion65@gmail.com) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.192]) by mx1.FreeBSD.org (Postfix) with ESMTP id C052E44013 for ; Thu, 1 Dec 2005 14:44:38 +0000 (GMT) (envelope-from illusion65@gmail.com) Received: by wproxy.gmail.com with SMTP id 37so360303wra for ; Thu, 01 Dec 2005 06:44:37 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=udNfJDBuMxz8cmKU9723ROpQEQmcmRN51xzvvhmTUbN4lyniBiM7VGqwdWXKzY5ET3d7mZHNPJH20De6qfIsQrWJG25qs73yjIAlaaLnfSINpdTWB29m3xHd/fCwOB6m+ar5foj4HTEc0S2P0XrzzrmIN/SYIpJAhVInDhhT3+k= Received: by 10.64.204.17 with SMTP id b17mr849407qbg; Thu, 01 Dec 2005 06:44:36 -0800 (PST) Received: by 10.65.233.1 with HTTP; Thu, 1 Dec 2005 06:44:36 -0800 (PST) Message-ID: <57750f110512010644g7fb74426j7aba31511f5d11ce@mail.gmail.com> Date: Fri, 2 Dec 2005 03:44:36 +1300 From: Doug H To: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Rebuilding a corrupt disklabel 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: Thu, 01 Dec 2005 15:09:04 -0000 I tried posting this 12 hours ago, but haven't seen it flow through the list... reposting with updates: One of my disks has 3 active partitions: FreeBSD 5.4-RC3, NTFS (not-bootable), and FreeBSD 6.0-RELEASE. I developed problems while installing FreeBSD 6.0. Installation went well, but when I rebooted, nothing was bootable on that disk. I verified that th= e boot record (using boot0) seems okay: slice table is fine (40G, 80G, 40G, and 40G unused on 200G drive). Using bsdlabel, I confirmed that slice 3 (FreeBSD 6) is fine, but for some reason I'm not concerned with now, is unbootable. PROBLEM: bsdlabel showed me that slice 1 (FreeBSD 5.4) is damaged and only partition c existed and was incorrect. I do not have & cannot find a written copy of my disklabel for that disk (a good suggestion to *strongly emphasize* in the installation manual for newbies!). I did recall that ad1s1a ('/') was 512M, so I was able to write a label and mount the root partition from a "Fixit" shell. QUESTIONS: How can I rederive the remaining disklabel for that disk? Could a copy possibly be stored somewhere on root if I didn't do it myself when building the system? I have not tried to boot from that root partition. Trying several possible labels has resulted in "incorrect super block" errors for the partitions after 'a'. Random guessing will be very tedious. My research has indicated that I could binary grep the raw ad1s1c partition to locate the magic numbers for the super blocks and derive the partitions from that information. I even found a little 'c' language program Peter Dufault posted 11 years ago on this list to locate magic numbers. My hope is that in 11 years of development, FreeBSD will have created a clever tool to aid this process! I've found enough entries while searching these lists to think that the effort would be justified and much appreciated. I found the value of FS_UFS2_MAGIC =3D 0x19540119. I presume that's what I should search for - it's a UFS2 filesystem. Having only a "Fixit" shell is somewhat limiting. I tried 'grep -ab -f pat /dev/ad1s1a' on a FreeBSD 5.1 installation, but it crashed with a swap error. The 'pat' file has the 4-byte magic number. It works with a small test file I create= d using vi. Thanks, Doug