Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Dec 2007 16:51:27 +0100
From:      Nikola =?UTF-8?B?TGXEjWnEhw==?= <nikola.lecic@anthesphoria.net>
To:        "Snow Mountains" <snow.mountains.4@gmail.com>
Cc:        FreeBSD-questions@FreeBSD.org
Subject:   Re: Lost FreeBSD slices (labels?) after NetBSD install -- please help!!
Message-ID:  <20071216165127.64661122@anthesphoria.net>
In-Reply-To: <3cf9f8920712132115q341401dbhec96ca1ae3156432@mail.gmail.com>
References:  <3cf9f8920712132115q341401dbhec96ca1ae3156432@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hello,

On Fri, 14 Dec 2007 05:15:16 +0000
"Snow Mountains" <snow.mountains.4@gmail.com> wrote:
=20
> People, I have FreeBSD install on 80G disk that looked like this:
>=20
> ad1s1 ~ 2.4G
> ad1s2 ~23.0G
> ad1s3 ~19.1G
> ad1s4 ~38.0G, FreeBSD partition, sliced like this:
                        ^^^^^^^^^  ^^^^^^
       (a note: the correct terminology is actually the opposite:
       these a...e are "partitions", real BSD partitions.
       What is called "partition" in non-BSD world is a slice here;
       so: "FreeBSD slice, (BSD-)partitioned/labelled like this...")

> ------------------------
> ad1s4a /     (507630 1K-blocks)
> ad1s4b swap
> ad1s4d /var
> ad1s4e /tmp
> ad1s4f /usr
>=20
[...]
> However, FreeBSD is now unbootable!!! Then I loaded FreeSBIE (FreeBSD
> 6.2 live CD), tried 'boot0cfg -B /dev/ad1' (also with '-d 0x80'), but
> no help! Then I realized that ad1s4 slices are lost. This means:
>=20
> A) from FreeSBIE, there is only /dev/ad1s4, no a,b,d,e,f. If I do
> this: FreeSBIE# mount /dev/ad1s4 /mnt/ufs.4
> this is former / (ad1s4a) and is of its size (~507M).

This probably means that you unwillingly changed FreeBSD label of ad1s4
and it's most likely that NetBSD wrote its own instead. However, from
the bsdlabel(8) manpage:

     The various BSDs all use slightly different versions of BSD labels
     and are not generally compatible.

So, NetBSD didn't recognise FreeBSD's labels and understood entire
ad1s4 as one partition; however, ad1s4's reality is that it begins with
small / (lost ad1s4a) and that is what you see; the rest is just
ignored.

boot0cfg did nothing because NetBSD obviously deleted ad1s4 FreeBSD's
bootstrap code as well.

> I can't reach other slices! However, it gives me hope that NetBSD's
> slices are also invisible, although working from within itself:
> FreeSBIE# mount /dev/ad1s1 /mnt/ufs.1
> gives also small NetBSD's / (its wd0a), not /usr etc.

The same reason as above.

> [...]
> Please help me to recover my FreeBSD system. If I lost my data (ok, I
> understand they are buried, not erased), please tell me that gently.
> :-(

That's why I think that you haven't lost any data. You must however
re-create bsdlabel table on ad1s4. Since you didn't mention that you
have a backup of bsdlabel (do you? :-)), you must recover it.

There are two small utilities designed for this purpose, dlfind and
ffsrescue:

  http://www.42.org/~sec/resources/disklabel.html
  http://www.leidinger.net/FreeBSD/ffsrescue.tar.gz

but they don't recognise UFS2 beginning marks (only UFS1 ones).
However, I tested sysutils/testdisk and it recognised UFS2 labels on my
healthy slices perfectly, so there is no reason that it can't help
you, since it simply analyses slice contents. This utility is not part
of FreeSBIE, but I think that you can just download

  ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6.2-release/sysutil=
s/testdisk-6.3.tbz

Then untar it in ~freesbie and run the binary. Just do this:

  ./testdisk /dev/ad1s4

and choose "non partitioned" in the second menu. Please note that
testdisk will not recognise your swap. Then please try to compare
results (given in 512k-blocks) to what you remember about partition
sizes. If it gives you reasonable proportions, then re-creating a
bsdlabel shouldn't be a big problem.

So please take these actions and if the aforementioned assumptions are
correct and you obtain some useful info, we shall continue. :-)
--=20
Nikola Le=C4=8Di=C4=87 :: =D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0 =D0=9B=D0=B5=
=D1=87=D0=B8=D1=9B



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071216165127.64661122>