Re: Groupping restored partitions into slices

2012-11-06 Thread Thomas Mueller
 Short version: Is it possible to group existing partitions into slices
 without affecting data?

 Long version:

 I had a disk sliced/partitioned like this:

 ad4s1
   ad4s1a
   ad4s1b (swap)
   ad4s1d
   ad4s1e
   ad4s1f
 ad4s2 (storage)
 ad4s3
   ad4s3a
   ad4s3b (swap)
   ad4s3d
   ad4s3e
   ad4s3f

 Then, I accidentally deleted *something* (wrong use of boot0cfg),
 which left me with /dev/ad4 only!

 scan_ffs correctly detected where all 9 data partitions begin. I
 created new bsdlabel table, wrote it to ad4, so I now have

 ad4a (former ad4s1a)
 ad4b (former ad4s1b - swap)
 ad4d (former ad4s1d)
 ad4e (former ad4s1e)
 ad4f (former ad4s1f)
 ad4g (former ad4s2)
 ad4h (former ad4s3a)
 and beginning sectors of the rest (former ad4s3d-f). Of course, I
 can't make more than 8 labels.

 I can mount all of them and I see my data. I can even 'swapon ad4b'.

 Now, the question: how can I restore s1, s2 and s3? As you can guess,
 s1 and s3 were working systems.

 Processing all this from FreeBSD-8/amd64 on another disc.

 Thanks!
 Sergi M

For FreeBSD as opposed to NetBSD, and I believe, OpenBSD, disklabels/bsdlabels
are for the slice rather than the whole disk, unless you partition the disk in
dangerously dedicated mode.  So you should create one bsdlabel for ad4s1 and
install to the beginning of that partition, and ahother bsdlabel for ad4s3 and
install to the beginning of ad4s3.  Installation would be using bsdlabel.

That's what I think, I could possibly be wrong.

You can check the bsdlabel man page, accessible online from www.freebsd.org,
even if you have no working installation of FreeBSD.

One, or actually twice, NetBSD overwrote my FreeBSD disklabel/bsdlabel.  The 
first time, I lost my FreeBSD installation but had nothing really to save,
it was time to upgrade to FreeBSD 8.0.  The second time, I had much software
installed, but had the bsdlabel information saved in a file.  I booted a
FreeBSD rescue CD and restored the FreeBSD disklabel/bsdlabel, and was back
in business.

Tom
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Groupping restored partitions into slices

2012-11-06 Thread Snow Mountains
Thomas, thank you for reply! No, it wasn't dangerously dedicated disk.

However, what is the exact command to add ad4s1 and ad4s3 using
bsdlabel? Is it possible  at all? I thought I should use fdisk or
gpart for that.

Thanks,
Sergi M
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Groupping restored partitions into slices

2012-11-06 Thread Thomas Mueller
 Thomas, thank you for reply! No, it wasn't dangerously dedicated disk.

 However, what is the exact command to add ad4s1 and ad4s3 using
 bsdlabel? Is it possible  at all? I thought I should use fdisk or
 gpart for that.

 Thanks,
 Sergi M

You use fdisk to create what FreeBSD calls slices such as ad4s1, ad4s2, ad4s3
and disklabel to subdivide a slice into FreeBSD partitions such as ad4s1a,
ad4s1b, ad4s1c, etc.  gpart is used to create GPT partitions such as ad4p1,
ad4p2, ad4p3, etc.  Subdividing a slice into FreeBSD partitions is used with
MBR partition/slice table but not recommended with GPT.

The online FreeBSD bsdlabel man page is online at

http://www.freebsd.org/cgi/man.cgi?query=bsdlabelapropos=0sektion=0manpath=FreeBSD+9.0-RELEASEarch=defaultformat=html

One example given is

This is an example disk label that uses some of the new partition size
 types such as %, M, G, and *, which could be used as a source file for
 ``bsdlabel -R ad0s1 new_label_file'':

 # /dev/ad0s1:

 8 partitions:
 #size   offsetfstype   [fsize bsize bps/cpg]
   a:   400M   164.2BSD 4096 1638475 # (Cyl.0 - 
812*)
   b: 1G*  swap
   c:  **unused
   e: 204800*4.2BSD
   f: 5g*4.2BSD
   g:  **4.2BSD

but you would have to replace the * with actual appropriate numbers.

After you install the disklabel, you could mount each data partition, but not
the swap partition, to see if the directory and file structure looks right.

Tom
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Groupping restored partitions into slices

2012-11-06 Thread Snow Mountains
Thomas, thank you very much for your mail, but that isn't what I asked.

Of course, I know that bsdlabel -R ad0s1 new_label_file writes new
labels to ad0s1.

My question is: what to do if I _lost_ s1, s2, and s3 - how to recover
_them_ first? Without that, all I can do is to write labels table
directly on ad0.

SergiM.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Groupping restored partitions into slices

2012-11-06 Thread Thomas Mueller
 Thomas, thank you very much for your mail, but that isn't what I asked.

 Of course, I know that bsdlabel -R ad0s1 new_label_file writes new
 labels to ad0s1.

 My question is: what to do if I _lost_ s1, s2, and s3 - how to recover
 _them_ first? Without that, all I can do is to write labels table
 directly on ad0.

 SergiM.

I thought you had found where the slices and partitions had been.  Otherwise,
if you only have the BSD partitions and need to label more than 8, there is
gpart in FreeBSD base system and Rod Smith's gdisk, available in FreeBSD ports
and also on the System Rescue CD (sysresccd.org).  If you switch to GPT, you 
can accommodate 128 partitions by default, and you wouldn't need the original
slices, just the BSD partitions in what had been the slices.

If you switch to GPT as opposed to MBR, you won't use bsdlabel; partitions for
each FreeBSD installation would be listed in /etc/fstab.

If you have the data, where each slice began and ended, you can restore the
slices with fdisk.

If you can find the BSD partitions and have the media space to backup to, you
might want to backup the partitions if feasible, as protection in case you
mess up.

NetBSD disklabel can accommodate up to 16 partitions per hard disk, but
FreeBSD might not be able to properly read a NetBSD disklabel.  Also, NetBSD
disklabel is very tricky and temperamental; I'd surely trust gdisk or gpart
over NetBSD disklabel.

Tom
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org