Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Dec 2007 04:39:51 +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:  <20071219043951.58ee4e50@anthesphoria.net>
In-Reply-To: <3cf9f8920712181854p1b498d8cve22e5bcdc0ad9fc7@mail.gmail.com>
References:  <3cf9f8920712132115q341401dbhec96ca1ae3156432@mail.gmail.com> <20071216165127.64661122@anthesphoria.net> <3cf9f8920712181854p1b498d8cve22e5bcdc0ad9fc7@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 19 Dec 2007 03:54:00 +0100
"Snow Mountains" <snow.mountains.4@gmail.com> wrote:
=20
[...]
> Hello and thanks veeeery much for this response and because you
> pointed me to right direction - what to read! It took me some time to
> run this and to understand always what I am doing, but it seems to
> work!
>=20
> testdisk gives me sizes that 100% correspond with _partition_ (:))
> proportions I remember (and some nonsenses about tiny FAT partition
> somewhere...). dlfind homepage was incredibly useful for me as newbie
> in creating BSD partition labels, and I created bsdlabel file,
> carefully calculated offsets, I am happy that former ad1s4a is
> mountable so that I can read /etc/fstab!

Excellent! Just note that you don't need to calculate offsets; you can
use asterisk (*) for all offsets from b: (swap) onward; and you can use
* as the size of the last partition, too.

> However I have several questions just to be 100% sure.
>=20
> a. swap size: by an accident, I have written swapsize (from swapinfo)
> of 1024 1kb blocks; it is slightly different from what I get when I
> subtract all partition size from total slice's size (as testdisk
> reported). What I should trust?

Use the value from swapinfo; swap is just that space (unlike sizes that
you see in df(1) output: they are not sizes of partitions).

The size of slice: you should anyway _first_ run 'bsdlabel-w /dev/ad1s4'
-- it will write initial info and the value for c: will be the value
you should use.

> b. Do I need just bsdlabel -R -e?=20

You probably typoed, either '-R' or '-e' (=3D 'from file' or 'to edit
directly'). However, I believe you should use '-B' as well, because
bootstrap code was destroyed too, and you won't be able to boot
FreeBSD even with recovered partitions.

> Is it safe to experiment?

Yes, it is. If you write wrong data, it will just not work. Once you
get mountable partitions, please fsck(8) them.

> c. What to write as fsize, bsize

fsize and bsize are 2048 and 16384 if you used all defaults when
installed FreeBSD (read newfs(8)).=20

> and bps/cpg? It is completly confusing for me, bps/cpg explanation
> from bsdlabel man page is unclear to me, I see that some people use
> all zeros and I can not find a clue in various examples...

Hmm, yes... Actually, it seems that they can be calculated by comparing
data obtained  from 'bsdlabel -A /dev/ad1s4...' (look at the top of the
output) and from particular 'newfs -N /dev/ad1s4X' (this command doesn't
create new file system but just prints all data about how it would be
created) -- but after recovery, of course. Read the entire thread that
contains this:

  http://lists.freebsd.org/pipermail/freebsd-questions/2004-January/031603.=
html

However, I've never been able to find any info in the docs that exactly
explains what algorithm newfs(8) uses for this field...

Therefore I believe (although I'm not 100% sure) that the only way to
get old bps/cpg data is to=20

  (1) dump(8) partitions once they work;
  (2) "bsdlabel -e" bps/cpg of these partitions to zeros;
  (3) recreate file systems there (this will write new (true) bps/cpg
      values);
  (4) restore(8) filesystems.

However, if fsck(8) tells you that filesystems are clear once you
recover them, I believe you don't have to worry about this. Maybe
some filesystem guru can confirm. (According to this reputable
source:

  http://www.onlamp.com/pub/a/bsd/2002/06/27/Big_Scary_Daemons.html

last three values are actually ignored...)
--=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?20071219043951.58ee4e50>