On Monday 11 December 2006 03:47, Foo JH wrote:
> Hi all,
> I unfortunately have 2 uneuqally sized SATA disks to set up a mirrored
> shared folder: 80GB and 120GB. On the 120GB I plan to set up this way:
> /temp        2GB (double the system memory)
> /shared    80GB
> /               38GB
> I plan to mirror /shared onto the 80GB. It won't be bootable, but I can
> always mount it onto another FreeBSD machine.
> I've read some articles on mirroring on non-equal disks, notably:
> http://people.freebsd.org/~rse/mirror/
> My question is: is there an easier way to do this? The example looks
> quiet daunting for a noobie FreeBSD admin like me.

I would use gmirror. The example page you cite is very thorough and covers 
multiple scenarios. I have found gmirror to be extremely easy to use and set 
up; much more so than gvinum or even ataraid.

Gmirrror allows you to use any geom provider as a member (consumer) of a 
mirrored set. That includes entire disks (e.g. ad4), slices (e.g. ad4s1), 
partitions (e.g. ad4s1a), or even other complex structures (such as a gstripe 

The only hard part is going to be labeling the 120GB disk correctly. You will 
most likely want to do it manually using bsdlabel. One approach would be 
something like the following. Assume ad4 is the 120GB disk and ad6 is the 
80GB disk. Boot up using a FreeBSD install disk and go into "Fixit" mode.

# fdisk -BI /dev/ad6
(it's safe to ignore the warning here)

# bsdlabel -Bw /dev/ad6s1

# sysctl kern.module_path="/dist/boot/kernel"

# gmirror load

# gmirror label -b load shared /dev/ad6s1a
("shared" is the name of your volume.. you can use whatever you want)

# gmirror list
(will show you details about your new "broken" mirror. Make a note of 
the "Mediasize" number listed under the consumer.)

# fdisk -BI /dev/ad4
(it's safe to ignore the warning here)

# bsdlabel -Bw /dev/ad4s1

(these are only needed if you don't like/don't know how to use vi)
# export EDITOR

# bsdlabel -e /dev/ad4s1

Now comes the tricky part. The number shown on the c: line of the label is the 
number of 512-byte sectors on the disk. It's good practice to leave 16 
sectors unused at the beginning of the disk; you can see this in the default 
whole-disk a: line. Figure out how big you need to make the slice for the 
other side of the mirror by dividing the Mediasize number you noted 
previously by 512. Then figure out how big you want your swap (if any--you 
didn't mention any above) and /temp partitions by multiplying out to the 
number of bytes then dividing by 512. Add all of that up plus the 16-sector 
space at the beginning and subtract from the size (c: line) to determine how 
much is left for /. Calculate all the offsets and put in the fstype (either 
4.2BSD or swap), and put zeroes in the other columns.

As a reference, here is one of my disks:

# /dev/ad4s1:
8 partitions:
#        size   offset    fstype   [fsize bsize bps/cpg]
  a:  6291456  1048502    4.2BSD        0     0     0 
  b:  1048486       16      swap                    
  c: 156312513        0    unused        0     0         # "raw" part, don't 
  d: 117266625 39045888    4.2BSD        0     0     0 
  e: 31705930  7339958    4.2BSD        0     0     0 

Save the label and exit the editor.

Now to finish up:

# gmirror insert shared /dev/ad4s1e
(be sure to use the actual partition device you set up above)

# newfs -U /dev/mirror/shared
( /shared )
# newfs -U /dev/ad4s1a
( / )
# newfs -U /dev/ad4s1d
( /temp )

Then exit fixit mode and do a Standard installation. Don't let sysinstall 
re-label or newfs anything, just specify the mount points for your / 
and /shared filesystems. You'll have to mount the mirror after you're done 
with setup (just put it in /etc/fstab manually).

Obviously, you should understand what all of the above does before you do any 
of it, and may need to make changes.

Good luck, and feel free to ask additional questions.

freebsd-questions@freebsd.org mailing list
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to