From owner-freebsd-questions@FreeBSD.ORG Mon Dec 11 18:38:01 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1961C16A4CE for ; Mon, 11 Dec 2006 18:38:01 +0000 (UTC) (envelope-from lists@jnielsen.net) Received: from ns1.jnielsen.net (ns1.jnielsen.net [69.55.238.237]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7D87843DF4 for ; Mon, 11 Dec 2006 18:16:36 +0000 (GMT) (envelope-from lists@jnielsen.net) Received: from localhost (jn@ns1 [69.55.238.237]) (authenticated bits=0) by ns1.jnielsen.net (8.12.9p2/8.12.9) with ESMTP id kBBIHi2R073785; Mon, 11 Dec 2006 10:17:45 -0800 (PST) (envelope-from lists@jnielsen.net) From: John Nielsen To: freebsd-questions@freebsd.org Date: Mon, 11 Dec 2006 13:16:21 -0500 User-Agent: KMail/1.9.4 References: <200612100905.30430.kirk@strauser.com> <20061211054125.GB681@pubbox.net> <457D1B24.8060109@extracktor.com> In-Reply-To: <457D1B24.8060109@extracktor.com> X-Face: #X5#Y*q>F:]zT!DegL3z5Xo'^MN[$8k\[4^3rN~wm=s=Uw(sW}R?3b^*f1Wu*.<=?utf-8?q?of=5F4NrS=0A=09P*M/9CpxDo!D6?=)IY1w<9B1jB; tBQf[RU-R<,I)e"$q7N7 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200612111316.21351.lists@jnielsen.net> X-Virus-Scanned: ClamAV version 0.88.4, clamav-milter version 0.88.4 on ns1.jnielsen.net X-Virus-Status: Clean Cc: Foo JH Subject: Re: Setting up RAID-1 on 2 unequal disks X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Dec 2006 18:38:01 -0000 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 set). 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) # EDITOR=ee # 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 edit 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. JN