From owner-cvs-all Sun Jan 26 3:40:39 2003 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2D9C837B401 for ; Sun, 26 Jan 2003 03:40:13 -0800 (PST) Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id 145C143F1E for ; Sun, 26 Jan 2003 03:40:09 -0800 (PST) (envelope-from ru@whale.sunbay.crimea.ua) Received: from whale.sunbay.crimea.ua (root@localhost) by whale.sunbay.crimea.ua (8.12.6/8.12.6/Sunbay) with SMTP id h0QBe3xQ058703 for ; Sun, 26 Jan 2003 13:40:03 +0200 (EET) (envelope-from ru@whale.sunbay.crimea.ua) Received: from whale.sunbay.crimea.ua (ru@localhost [127.0.0.1]) by whale.sunbay.crimea.ua (8.12.6/8.12.6/Sunbay) with ESMTP id h0QBe04N058663 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Sun, 26 Jan 2003 13:40:03 +0200 (EET) (envelope-from ru@whale.sunbay.crimea.ua) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.12.6/8.12.6/Submit) id h0QBe0RR058649; Sun, 26 Jan 2003 13:40:00 +0200 (EET) Date: Sun, 26 Jan 2003 13:40:00 +0200 From: Ruslan Ermilov To: Poul-Henning Kamp Cc: cvs-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/sbin/disklabel disklabel.8 disklabel.c Message-ID: <20030126114000.GA58366@sunbay.com> References: <200301261111.h0QBBJ5M090267@repoman.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="OwLcNYc0lM97+oe1" Content-Disposition: inline In-Reply-To: <200301261111.h0QBBJ5M090267@repoman.freebsd.org> User-Agent: Mutt/1.5.1i Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --OwLcNYc0lM97+oe1 Content-Type: multipart/mixed; boundary="5vNYLRcllDrimb99" Content-Disposition: inline --5vNYLRcllDrimb99 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jan 26, 2003 at 03:11:19AM -0800, Poul-Henning Kamp wrote: > phk 2003/01/26 03:11:19 PST >=20 > Modified files: > sbin/disklabel disklabel.8 disklabel.c=20 > Log: > Retire the "-N" and "-W" options which implemented write-protection > for the disklabel: This facility is OBE. > =20 [...] > Fourth and finally, the disklabel is already protected against > tampering if it controls open partitions. > =20 Then maybe you could answer my old question (please see 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 --5vNYLRcllDrimb99 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-- --5vNYLRcllDrimb99-- --OwLcNYc0lM97+oe1 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE+M8kPUkv4P6juNwoRAuGpAJ0RwaCs9Fo7wKmwCSgEKvq9D338rACZAd5E AqKGOs3/kfasZ2SAsfgviAQ= =1jSB -----END PGP SIGNATURE----- --OwLcNYc0lM97+oe1-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message