Subject: Re: tool to recomputer/reconstruct a trashed disklabel?
To: Laine Stump <laine@laine.org>
From: Lubomir Sedlacik <salo@Xtrmntr.org>
List: netbsd-users
Date: 04/27/2003 16:13:29
--ALfTUftag+2gvp1h
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

hi,

On Sun, Apr 27, 2003 at 04:58:49PM +0300, Laine Stump wrote:
> Well, I just learned that installing FreeBSD 5.0 on the 2nd half of a
> disk that has NetBSD on the 1st half isn't very safe. (Possibly it
> happened because the disk was at wd2, not sure). Not only did the
> FreeBSD install fail to complete, it ended up trashing the NetBSD
> disklabel so that it said it was corrupt, and only shows partitions d,
> e, and f (and shows e starting at offset 63 and going to the end of
> the disk, which wasn't the case before).
>=20
> Fortunately this was a test disk, so there was nothing important on
> it.  Unfortunately, this means that I didn't take the time to mirror
> the disk anywhere before I tried the install, and it will take me
> several hours to rebuild all the pkgsrc stuff it had, and time to
> re-discover the right XF86Config files. I have a suspicion that the
> data is all still there, if I could just get the old disklabel back in
> place.
>=20
> Is there any utility that will search through the disk and find the
> start of FFS partitions (and maybe even their sizes)? Failing that, is
> there a short primer somewhere on what the start of an FFS partition
> looks like so I can whack together a quick tool to do so? Or should I
> give up and start reinstalling/building/configuring?

last time something similar happened to me (trashed disklabel when
splitting laptop drive and booting off swap partition) i booted from old
1.5 cd i had around and searched the drive for disklabel backup in
/var/backups with `less /dev/rwd0d` and seeking for keywords from
disklabel.  it took some time (few tens of minutes) to find it but
eventually i got it and recovered the disklabel with `disklabel -R`.

you could find it easier if you can boot some OS with more sophisticated
tools but that worked for me with the limited resources i had.  in case
you don't have the backup (running daily from cron) and the real
disklabel is physically overwritten, you can't do much but i could be
mistaken.  maybe someone has better idea.


regards,

--=20
-- Lubomir Sedlacik <salo@Xtrmntr.org>                   --
--                  <salo@silcnet.org>                   --

--ALfTUftag+2gvp1h
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (NetBSD)

iD8DBQE+q+WJiwjDDlS8cmMRAqutAJ9la5rbCJgncSzo9WlVTDDB3rLn1ACcDimQ
W5wGqPtTXux+nSCg8+rlK/0=
=F9/W
-----END PGP SIGNATURE-----

--ALfTUftag+2gvp1h--