I have a system that I set up to use a gmirror back in the 5.3beta days. It's running fine but I don't remember exactly how I set it up. It's a scsi system w/ two identical disks. I'd like to migrate the installation to a new box that uses ide disks, and am basing my attempts on the "GEOM mirror Approach 2: Single Slice, Preferred, More Flexible" portion of these instructions: http://people.freebsd.org/~rse/mirror/ Although the disk that I ended up with was bootable in the new system, I noticed that the slice table was messed up. After a couple of tries, here's what I've found: The machine is: FreeBSD merlin.alerce.com 5.3-RELEASE-p2 FreeBSD 5.3-RELEASE-p2 #9: Sat Dec 18 12:38:37 PST 2004 root@merlin.alerce.com:/usr/obj/usr/src/sys/MERLIN i386 Here's the series of commands that I've performed to illustrate the problem: 138 15:31 fdisk -v -B -I /dev/ad0 139 15:31 fdisk -s /dev/ad0 140 15:31 fdisk -s /dev/ad0 > ~hartzell/fdisk-initial 141 15:32 gmirror label -v -n -b round-robin disk0 /dev/ad0s1 142 15:32 fdisk -s /dev/ad0 143 15:32 bsdlabel -w -B mirror/disk0 144 15:32 bsdlabel -e mirror/disk0 145 15:33 fdisk -s /dev/ad0 146 15:34 fdisk -s /dev/ad0 > ~hartzell/fdisk-after 147 15:34 history 148 15:34 history > ~hartzell/history After the fdisk at line 138, here's the slice table: /dev/ad0: 387621 cyl 16 hd 63 sec Part Start Size Type Flags 1: 63 390721905 0xa5 0x80 The fdisk at line 142 showed that the slice table was fine after the gmirror step. But after the bsdlabels at lines 143 and 144 the slice table looks like this: /dev/ad0: 387621 cyl 16 hd 63 sec Part Start Size Type Flags 4: 0 50000 0xa5 0x80 Here's the output of "bsdlabel /dev/mirror/disk0": # /dev/mirror/disk0: 8 partitions: # size offset fstype [fsize bsize bps/cpg] a: 524272 16 4.2BSD 2048 16384 32768 b: 8336976 524288 swap c: 390721904 0 unused 0 0 # "raw" part, don't edit d: 524288 8861264 4.2BSD 2048 16384 32776 e: 524288 9385552 4.2BSD 2048 16384 32776 f: 380812064 9909840 4.2BSD 2048 16384 28552 Anyone see what I'm missing? g.
On Sat, Feb 05, 2005 at 04:45:50PM -0800, George Hartzell wrote:> > I have a system that I set up to use a gmirror back in the 5.3beta > days. It's running fine but I don't remember exactly how I set it up. > > It's a scsi system w/ two identical disks. > > I'd like to migrate the installation to a new box that uses ide disks, > and am basing my attempts on the > > "GEOM mirror Approach 2: Single Slice, Preferred, More Flexible" > > portion of these instructions: > > http://people.freebsd.org/~rse/mirror/ > > Although the disk that I ended up with was bootable in the new system, > I noticed that the slice table was messed up. After a couple of > tries, here's what I've found: > > The machine is: > > FreeBSD merlin.alerce.com 5.3-RELEASE-p2 FreeBSD 5.3-RELEASE-p2 #9: Sat Dec 18 12:38:37 PST 2004 root@merlin.alerce.com:/usr/obj/usr/src/sys/MERLIN i386 > > Here's the series of commands that I've performed to illustrate the > problem: > > 138 15:31 fdisk -v -B -I /dev/ad0 > 139 15:31 fdisk -s /dev/ad0 > 140 15:31 fdisk -s /dev/ad0 > ~hartzell/fdisk-initial > 141 15:32 gmirror label -v -n -b round-robin disk0 /dev/ad0s1 > 142 15:32 fdisk -s /dev/ad0 > 143 15:32 bsdlabel -w -B mirror/disk0 > 144 15:32 bsdlabel -e mirror/disk0 > 145 15:33 fdisk -s /dev/ad0 > 146 15:34 fdisk -s /dev/ad0 > ~hartzell/fdisk-after > 147 15:34 history > 148 15:34 history > ~hartzell/history > > After the fdisk at line 138, here's the slice table: > > /dev/ad0: 387621 cyl 16 hd 63 sec > Part Start Size Type Flags > 1: 63 390721905 0xa5 0x80 > > The fdisk at line 142 showed that the slice table was fine after the > gmirror step. > > But after the bsdlabels at lines 143 and 144 the slice table looks > like this: > > /dev/ad0: 387621 cyl 16 hd 63 sec > Part Start Size Type Flags > 4: 0 50000 0xa5 0x80 > > Here's the output of "bsdlabel /dev/mirror/disk0": > > # /dev/mirror/disk0: > 8 partitions: > # size offset fstype [fsize bsize bps/cpg] > a: 524272 16 4.2BSD 2048 16384 32768 > b: 8336976 524288 swap > c: 390721904 0 unused 0 0 # "raw" part, don't edit > d: 524288 8861264 4.2BSD 2048 16384 32776 > e: 524288 9385552 4.2BSD 2048 16384 32776 > f: 380812064 9909840 4.2BSD 2048 16384 28552 > > Anyone see what I'm missing?This is how I've done it. 1. Use "sysinstall" to do the slice table on the new disk, writing the FreeBSD "Boot Manager". QUIT Sysisntall after this (do NOT label the slice) 2. gmirror label -b round-robin disk0 ad0s1 3. bsdlabel -e /dev/mirror/disk0 Edit the label. Subtract ONE from the "c" partition size, which will be one sector too long. Write it out. If you got it right, there should be no complaints on the write. When you read it in, there should be only one (the "c") partition. 4. bsdlabel /dev/mirror/disk0 - insure that there are no complaints about the label. 5. newfs ....... each filesystem 6. Copy your filesystems over (use dump/restore, or pax) 7. Edit the /etc/fstab entries appropriately, make sure swapoff is in the /etc/rc file, etc. The result should be bootable and run. A bit different than the instructions in that page, but after fiddling with it this is the procedure I came up with, and it works. -- -- Karl Denninger (karl@denninger.net) Internet Consultant & Kids Rights Activist http://www.denninger.net My home on the net - links to everything I do! http://scubaforum.org Your UNCENSORED place to talk about DIVING! http://www.spamcuda.net SPAM FREE mailboxes - FREE FOR A LIMITED TIME! http://genesis3.blogspot.com Musings Of A Sentient Mind
George Hartzell
2005-Feb-06 11:05 UTC
Hardcoding gmirror provider [was Re: Problem with migrating...]
George Hartzell writes: > [...] > I'd like to migrate the installation to a new box that uses ide disks, > and am basing my attempts on the > > "GEOM mirror Approach 2: Single Slice, Preferred, More Flexible" > > portion of these instructions: > > http://people.freebsd.org/~rse/mirror/ > > Although the disk that I ended up with was bootable in the new system, > I noticed that the slice table was messed up. After a couple of > tries, here's what I've found: > > The machine is: > > FreeBSD merlin.alerce.com 5.3-RELEASE-p2 FreeBSD 5.3-RELEASE-p2 #9: Sat Dec 18 12:38:37 PST 2004 root@merlin.alerce.com:/usr/obj/usr/src/sys/MERLIN i386 > [...] I've figured out that if I hardcode the provider when I label my mirror everything seems to work out, which leaves me confused. Here's the label command I was using (modified for my situation): gmirror label -v -n -b round-robin disk0 /dev/ad0s1 After running that command, "gmirror list" tells me that the consumer for disk0 is "Name: ad0", even though I've specified ad0s1 above and when I bsdlabel the disk the slice table gets clobbered. If I do this instead: gmirror label -v -n -h -b round-robin disk0 /dev/ad0s1 then "gmirror list" tells me that the consumer is "Name: ad0s1" and bsdlabel doesn't stomp on the slice table. Am I [just] confused, and I tripping over a sharp piece of exposed code, or is this a bug. FWIW, I get the same behaviour on: FreeBSD merlin.alerce.com 5.3-RELEASE-p2 FreeBSD 5.3-RELEASE-p2 #9: Sat Dec 18 12:38:37 PST 2004 root@merlin.alerce.com:/usr/obj/usr/src/sys/MERLIN i386 and Freesbie 1.1 g.