Re: Lost FreeBSD slices (labels?) after NetBSD install -- please help!!

2007-12-19 Thread Snow Mountains
2007/12/19, Nikola Lečić [EMAIL PROTECTED]:
 On Wed, 19 Dec 2007 03:54:00 +0100
 Snow Mountains [EMAIL PROTECTED] wrote:

 [...]
  Hello and thanks vry 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!
 
  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.
 
  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.


Success!!! After several wrong tables, I got right one, my dear
documents are now visible and readable again! Correct size of swap was
indeed size reported by swapinfo.


  b. Do I need just bsdlabel -R -e?

 You probably typoed, either '-R' or '-e' (= '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.


Indeed (-B), and FreeBSD is bootable again.

  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.


fsck said: FREE BLK COUNT(S) WRONG IN SUPERBLK -- SALVAGE? on all
partitions except ad1s4a; I said 'yes' and now it says they are clean.

  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)).

  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

   (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...)
 --
 Nikola Lečić :: Никола Лечић

I tried to google to find similar partition sizes, and to use their
bsdlabel values, but according to what you said everything depends on
specific disc hardware, so tables of other people are not 100%
usable...

But all-zeroes seems to work 100% well and happy!

(And of course, backups are the first thing to do!)

Resume, for archives, what I did in FreeSBIE with your explanations:

o Use disk size reported from raw bsdlabel -w
o Use swap size reported from swapinfo, or guess, but the subtracted
value (disk - sum of other partitions) was not correct for me... :(
o Use partition sizes reported from testdisk
o Assemble table accorting to bsdlabel manual page and to, for
example, dlfind homepage
o Write it with -B option.
o Try to mount; nothing? Play with swap size...
o Mountable? fsck them
o Correct everything fsck wants.
o that's it.

thank you!
Sergi M
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]

Re: Lost FreeBSD slices (labels?) after NetBSD install -- please help!!

2007-12-18 Thread Snow Mountains
2007/12/16, Nikola Lečić [EMAIL PROTECTED]:
 Hello,

 On Fri, 14 Dec 2007 05:15:16 +
 Snow Mountains [EMAIL PROTECTED] wrote:

  People, I have FreeBSD install on 80G disk that looked like this:
 
  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
 
 [...]
  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:
 
  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/sysutils/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. :-)

Hello and thanks vry 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!

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!

However I have several questions just to be 100% sure.

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?

b. Do I need just bsdlabel -R -e? Is it safe to experiment?

c. What to write as fsize, bsize 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...

Again, many thanks!
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]

Re: Lost FreeBSD slices (labels?) after NetBSD install -- please help!!

2007-12-18 Thread Nikola Lečić
On Wed, 19 Dec 2007 03:54:00 +0100
Snow Mountains [EMAIL PROTECTED] wrote:
 
[...]
 Hello and thanks vry 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!
 
 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.
 
 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? 

You probably typoed, either '-R' or '-e' (= '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)). 

 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 

  (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...)
-- 
Nikola Lečić :: Никола Лечић
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Lost FreeBSD slices (labels?) after NetBSD install -- please help!!

2007-12-16 Thread Nikola Lečić
Hello,

On Fri, 14 Dec 2007 05:15:16 +
Snow Mountains [EMAIL PROTECTED] wrote:
 
 People, I have FreeBSD install on 80G disk that looked like this:
 
 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
 
[...]
 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:
 
 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/sysutils/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. :-)
-- 
Nikola Lečić :: Никола Лечић
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Lost FreeBSD slices (labels?) after NetBSD install -- please help!!

2007-12-13 Thread Snow Mountains
Hi,

People, I have FreeBSD install on 80G disk that looked like this:

ad1s1 ~ 2.4G
ad1s2 ~23.0G
ad1s3 ~19.1G
ad1s4 ~38.0G, FreeBSD partition, sliced like this:

ad1s4a / (507630 1K-blocks)
ad1s4b swap
ad1s4d /var
ad1s4e /tmp
ad1s4f /usr

First three partitions are former fat/ntfs that I emptied, transformed
to FreeBSD's ufs2 and used as FreeBSD storage. I used boot0cfg and my
boot menu looked like this:

F1 DOS (although nothing were installed in F1-F3, just ufs2 data)
F2 DOS
F3 DOS
F4 FreeBSD

Today, however, I decided to try a small NetBSD install on small
ad1s1, I thought I could do no harm if I tell it to install itself
onto first partition. So I passed through install, carefully checked
partition1 (on wd0 disk according to it) for mark 'new fs', and sliced
it did like this:

wd0a / (around 550M)
...
wd0e /usr
(total ~2,4M, as described above)

and left all other options (BSD labels etc.) as defaults. NetBSD
installed and booted, menu looked like this:

F1 BSD
F2 DOS
F3 DOS
F4 FreeBSD

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:

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).

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.

B) From NetBSD:
FreeBSD's ad1s2  - NetBSD's wd0f (readable, data ok)
FreeBSD's ad1s3  - NetBSD's wd0g (readable, data ok)
FreeBSD's ad1s4a - NetBSD's wd0h (just /, 507M, readable)
others (ad1s4 d-f), containing /usr/home are lost!

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.
:-(

many thanks in advance
Sergi M
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]