OpenSolaris ZFS Root Pool Mirroring

This has been a real pain, due to incomplete and misleading documentation. I believe I’ve finally gotten it to work again, and I need to write down in some detail what I did.

This is based on installing OpenSolaris 2008.11. The two disks I want to make my root pool are c5t0d0 and c5t1d0. The general process is to install on one of the disks, and attach the second as a mirror later. Most of this requires root, and I see I haven’t been too careful showing that. Sometimes the “pfexec” command is showing, which is the OpenSolaris roles-oriented equivalent of sudo for executing one command with the root role.

First point: while in general you want to give ZFS whole disks to work with, you cannot do that for a root pool that you intend to mirror. There’s a nice convenient “whole disk” option in the installer, too, and no warning that you shouldn’t use it if you want to mirror later.

So, let’s say you’ve gone ahead and installed with nearly all of c5t0d0 as your zfs root pool (it’s called rpool), and now you want to make it a mirror.

First, using the format tool, see what the partition structure is (what I expect on an x86 box is one fdisk partition occupying the whole disk, and a set of Solaris slices in that). In my case, I think what the installer always does, s0 is the root slice, and it occupied cylinders 1-9724 on a disk having cylinders 0-9725. In any case — duplicate this structure on the disk you intend to mirror with (c5t1d0 in my case).

At which point your second disk will look like this:

Specify disk (enter its number)[1]: 1
selecting c5t1d0
[disk formatted]
format> verify

Primary label contents:

Volume name = <        >
ascii name  = 
pcyl        = 9728
ncyl        = 9726
acyl        =    2
bcyl        =    0
nhead       =  255
nsect       =   63
Part      Tag    Flag     Cylinders        Size            Blocks
  0       root    wm       1 - 9724       74.49GB    (9724/0/0) 156216060
  1 unassigned    wm       0               0         (0/0/0)            0
  2     backup    wu       0 - 9725       74.50GB    (9726/0/0) 156248190
  3 unassigned    wm       0               0         (0/0/0)            0
  4 unassigned    wm       0               0         (0/0/0)            0
  5 unassigned    wm       0               0         (0/0/0)            0
  6 unassigned    wm       0               0         (0/0/0)            0
  7 unassigned    wm       0               0         (0/0/0)            0
  8       boot    wu       0 -    0        7.84MB    (1/0/0)        16065
  9 unassigned    wm       0               0         (0/0/0)            0

Now you can mirror it:

pfexec zpool attach -f rpool c5t0d0s0 c5t1d0s0

The “-f” is necessary because, in previous playing around, I’ve sometimes managed to get a recognizable part of a zpool on that slice, so I have to tell zpool to overwrite it. So be VERY careful using -f! Don’t do it at first, and if you get an error and you’re SURE you really want to overwrite the old data, then use -f.

So this was very successful:

localddb@fsfs:/boot/grub$ zpool status
  pool: rpool
 state: ONLINE
 scrub: resilver completed after 0h3m with 0 errors on Sun Jan 18 11:28:36 2009
config:

	NAME          STATE     READ WRITE CKSUM
	rpool         ONLINE       0     0     0
	  mirror      ONLINE       0     0     0
	    c5t0d0s0  ONLINE       0     0     0  25.6M resilvered
	    c5t1d0s0  ONLINE       0     0     0  3.57G resilvered

errors: No known data errors

Now, to do a really complete job, you need to install grub on the secondary disk as well. In fact zpool will tell you you should do that. If you don’t do this, you won’t be able to boot from just the second disk when something happens to the first one. (Yes, “when”. Murphy rules!)

So, to install grub:

localddb@fsfs:/$ cd /boot/grub
localddb@fsfs:/boot/grub$ pfexec installgrub stage1 stage2 /dev/rdsk/c5t1d0s0
stage1 written to partition 0 sector 0 (abs 16065)
stage2 written to partition 0, 267 sectors starting at 50 (abs 16115)

And that should be that.

A suppose a truly wise admin would play with various failure modes and recoveries before going on to install much on this base.

The Mythical “Gun-Show Loophole”

Another myth perpetrated by anti-gun forces. There are no  transactions permitted at a gun show that are not permitted anywhere else. (State law controls much of private transfer of firearms; I believe what I say is correct for Minnesota, and I think it’s true in a lot of other states as well, but be sure to check what the law really is in your state before transferring any firearms! I am not a lawyer and this is not legal advice!)

What the anti-gun forces really want to do is to ban all private transfers of firearms, and force us to go through a federally licensed dealer for each one. This would drastically restrict availability of firearms to legal owners, and probably significantly raise costs. Licensed dealers are hard to find.  There isn’t one in the city of Minneapolis, for example; you have to drive out to the suburbs quite a ways to get to one. The dealers would of course charge money for this service, too. In more rural areas, there may not be one for 100 miles; since one thing “accomplished” during the Clinton administration was to revoke the licenses of a lot of part-time dealers (they targeted everybody without a full-time store-front).

Officially, the goal is to make sure the people who buy through private transactions aren’t people barred from owning firearms.

Of course, it’s already illegal for me to sell to somebody I have reason to believe isn’t allowed to own the firearm, but I’m not required (and in fact I have no means) to run a background check on the buyer. What most people I know do in Minnesota is only sell to people who have a carry permit or a “permit to purchase” issued by their local police; these documents show the person has passed the background check.  This isn’t legally required, but the gun-owners I know don’t like the idea of guns getting into the hands of bad guys any more than anybody else.

More to the point, there isn’t any evidence pointing to legal sales through private owners being a significant source of guns used in crimes.  Most of them are stolen, from stores or police cars or private homes, or smuggled into the country by gangs (who, after all, routinely smuggle in tons of other contraband; do you really believe they won’t have guns if they want guns?). Some are bought by legal purchasers who are friends of the intended illegal recipients (often their girlfriends); these transactions are called “straw purchases” and are already a felony. In other countries, raids on police and military armories have been resorted to.

Incidentally, one of the reasons gun shows are so important is precisely that there aren’t that many gun stores around.  For a lot of people, waiting for a gun show to come by is their best way to see a wide range of merchandise and be able to decide what they want to buy. At a gun show, you get to see merchandise from a lot of dealers from a very large geographic area, conveniently exhibiting in one room for your convenience.

The existence of a vibrant used market in guns helps keep prices down (back to my theme that guns shouldn’t be a tool or hobby reserved for the rich). Collectors do some speculating as well, and late in their lives often cash in much of their collection; requiring each transaction to go through a licensed dealer would be a hideous barrier to selling off a collection, and would no doubt cost these people huge amounts of money (good collections are easily worth tens of thousands of dollars, even if they haven’t invested nearly that much into them, as guns have appreciated a lot over the last few decades).

Where is the line between somebody selling off a collection, and somebody making a living as an unlicensed dealer?  There’s lots of law about this, and the BATFE is fairly active in pursuing unlicensed dealers (in fact, over-active; they lose a lot of cases, that is, the courts decide the person is not in fact acting as an unlicensed dealer). The point is, there isn’t a “problem” with unlicensed dealers. A person who sells off a collection he’s owned for a long time, without buying a lot of new guns he then sells off, is clearly a collector selling a collection, even if the numbers sold are fairly high (for a while); he’s not any sort of dealer, and shouldn’t have the extreme limits applied to dealers applied to him. Even if he happens to rent a table at a gun show to sell some of them.

I won’t even try to go into the additional complexities this would add to gifts and inheritances.

I’d love to talk to anybody who wants to understand this in more detail, has questions, or whatever, in the comments sections here, in email, in person, or however is convenient.