Date: Sun, 26 Jan 2003 13:40:00 +0200 From: Ruslan Ermilov <ru@freebsd.org> To: Poul-Henning Kamp <phk@freebsd.org> 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> In-Reply-To: <200301261111.h0QBBJ5M090267@repoman.freebsd.org> References: <200301261111.h0QBBJ5M090267@repoman.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--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 <ru@FreeBSD.org> To: hackers@FreeBSD.org Bcc: Igor Kucherenko <kivvy@sunbay.com> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030126114000.GA58366>