From owner-freebsd-hackers@FreeBSD.ORG Sat Apr 5 01:01:18 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B496737B404 for ; Sat, 5 Apr 2003 01:01:18 -0800 (PST) Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id F1D2143FB1 for ; Sat, 5 Apr 2003 01:01:14 -0800 (PST) (envelope-from ru@whale.sunbay.crimea.ua) Received: from whale.sunbay.crimea.ua (ru@localhost [127.0.0.1]) h35919gg060962 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 5 Apr 2003 12:01:11 +0300 (EEST) (envelope-from ru@whale.sunbay.crimea.ua) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.12.9/8.12.8/Submit) id h35918i1060957; Sat, 5 Apr 2003 12:01:08 +0300 (EEST) (envelope-from ru) Date: Sat, 5 Apr 2003 12:01:08 +0300 From: Ruslan Ermilov To: af asdf Message-ID: <20030405090108.GA55982@sunbay.com> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="+pHx0qQiF2pBVqBT" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.4i cc: freebsd-hackers@FreeBSD.ORG Subject: Re: disklabal messed, need help! X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Apr 2003 09:01:19 -0000 --+pHx0qQiF2pBVqBT Content-Type: multipart/mixed; boundary="IJpNTDwzlM2Ie8A6" Content-Disposition: inline --IJpNTDwzlM2Ie8A6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Mar 26, 2003 at 01:03:03AM +0800, af asdf wrote: >=20 > Anyone knows how to repair disk when the freebsddisk lable is destroyed? >=20 > I have a 12G HD, the 1st partition is Windows NT, the second the for=20 > FreeBSD. For some reason i installed a new disk label to it and newfs it = a=20 > bit. Once I found the newfs started, I have turned power off right away,= =20 > but the disk is bad now. anyone knows how to repair this? >=20 Yes. Read the attached. Cheers, --=20 Ruslan Ermilov Sysadmin and DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age --IJpNTDwzlM2Ie8A6 Content-Type: message/rfc822 Content-Disposition: inline Date: Tue, 9 Jul 2002 14:29:45 +0300 From: Ruslan Ermilov To: hackers@FreeBSD.org Bcc: Igor Kucherenko Subject: How I managed to lose (and then recover) my disklabel Message-ID: <20020709112945.GA79816@sunbay.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="J/dobhs11T7y2rNN" Content-Disposition: inline User-Agent: Mutt/1.3.99i --J/dobhs11T7y2rNN Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! I have my disk set in a so-called dangerously-dedicated mode, and its disklabel looks like this: 8 partitions: # size offset fstype [fsize bsize bps/cpg] a: 8388608 262144 4.2BSD 1024 8192 16 # (Cyl. 260*- 8582= *) b: 262144 0 swap # (Cyl. 0 - 260*) c: 19932192 0 unused 0 0 # (Cyl. 0 - 1977= 3) d: 11281440 8650752 4.2BSD 1024 8192 16 # (Cyl. 8582*- 1977= 3*) I recently upgraded the amount of RAM available on this machine from 128M to 256M, and it took me a while to figure out why swapon(8) no longer wants to enable swapping on `b' (which is only 128M large). I was pretty tired at the moment, and I thought that maybe the problem is with the contents of my `b' partition, so I did: dd if=3D/dev/zero of=3D/dev/ad0b bs=3D512 count=3D1000. This did not help, and eventually I recalled the fact of upgrading RAM, and I've looked into some /sys/kern code to verify my guesses. Nevertheless, I continued with my work on this machine, and compiled and installed the new kernel (without any problems) on it. Next reboot refused to boot FreeBSD by mentioning that "No operating system was found". I wondered how I managed to screw my disk up. It was too late in the night, so I delayed it until the next morning. The night and next morning gave me the knowledge about what I did wrong, and it surprised me a lot, as I never thought about it before. The disklabel occupies the first sectors of the disk (or slice, if you are under i386 and have your disk sliced). My `b' partition starts from the very first sector of my disk, so when I did the dd(1) it overwrote the disklabel of my disk with zeroes. Once I understood and verified it, I recovered from this very fast. I remembered that my swap partition was first and exactly 128M large, so I skipped over this space, and saved some amount of my `a' partition into a plain file. Fortunately, file(1) is smart enough to read the superblock and tell you about the size of the filesystems. This way I found the size of my `a' partition and an offset for my `d' partition. Hope this technique could help someone in a similar situation. Now the question. Where is the code in the kernel that prevents swapping and/or writing to a disklabel portion of a physically first partition on the disk? Thanks, --=20 Ruslan Ermilov Sysadmin and DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age --J/dobhs11T7y2rNN Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (FreeBSD) iD8DBQE9KskpUkv4P6juNwoRAhZyAJ992MFDKIqmNlIyR4y1d9uQqcqDjwCdER1Q HRI8XYev1XiP/rwuXor60hc= =W6/d -----END PGP SIGNATURE----- --J/dobhs11T7y2rNN-- --IJpNTDwzlM2Ie8A6-- --+pHx0qQiF2pBVqBT Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE+jptUUkv4P6juNwoRAnkLAJ9dzLVVBHi0e7xepPIu0JZ5yKHRlQCgiOlh we7cF5L1hmOm4LOo4tKJRQU= =Q3Wi -----END PGP SIGNATURE----- --+pHx0qQiF2pBVqBT--