6. Volume Lesson 3: RAID1 and RAID0+1 Volumes

With the same ease we used to create simple and striped volumes we'll now build mirrored volumes. We'll start with a simple 10G mirrored volume so that we can see how a RAID1 volume will look when using 2 disks for each mirror. But first, let's examine the syntax:

vxassist -g <diskgroup> -U <usagetype> make <volname> <size> \
	layout=<layouttype>  <disk1> <disk2> <disk3> ...

This syntax is looking real repeditive isn't it. In this case we'll use the same options as usual, but we'll specify the layout as "mirror-concat":

# vxassist -U fsgen -g cuddledg make mirrorvol3 10g layout=mirror-concat
# vxprint -g cuddledg -hrt
DG NAME         NCONFIG      NLOG     MINORS   GROUP-ID
DM NAME         DEVICE       TYPE     PRIVLEN  PUBLEN   STATE
V  NAME         USETYPE      KSTATE   STATE    LENGTH   READPOL   PREFPLEX
PL NAME         VOLUME       KSTATE   STATE    LENGTH   LAYOUT    NCOL/WID MODE
SD NAME         PLEX         DISK     DISKOFFS LENGTH   [COL/]OFF DEVICE   MODE
SV NAME         PLEX         VOLNAME  NVOLLAYR LENGTH   [COL/]OFF AM/NM    MODE

 (..... removed ......)

v  mirrorvol    fsgen      ENABLED  ACTIVE   20971520 SELECT    -
pl mirrorvol-01 mirrorvol  ENABLED  ACTIVE   20975031 CONCAT    -        RW
sd cuddle-f4-01 mirrorvol-01 cuddle-f4 0      3296538  0         c1t4d0   ENA
sd cuddle-r4-01 mirrorvol-01 cuddle-r4 0      17678493 3296538   c1t20d0  ENA
pl mirrorvol3-02 mirrorvol  ENABLED  ACTIVE   20975031 CONCAT    -        RW
sd cuddle-f5-01 mirrorvol-02 cuddle-f5 0      3296538  0         c1t5d0   ENA
sd cuddle-r3-01 mirrorvol-02 cuddle-r3 0      17678493 3296538   c1t19d0  ENA

The beauty here is that the mirroring is done all in one faul swoop. You can go so far as to even use an optional parameter after specifing the layout to vxassist which will create multiple mirrors! To do this use the option: "nmirror=X" where X is the number of mirrors (plexes) you want.

It should be noted, that you can also create a volume that isn't mirrored and then mirror it later using the following syntax:

vxassist -g <diskgroup> mirror <volname>

This will create a mirror that is (hopefully) identical to the exsisting plex. Here's an example of creating a 10g striped volumes and then mirroring it afterwards:

# vxassist -g cuddledg -U fsgen make stripevol 10g layout=stripe  
# vxprint -g cuddledg -hrt stripevol
	(... removed ...)
v  stripevol    fsgen        ENABLED  ACTIVE   20971520 SELECT    stripevol-01
pl stripevol-01 stripevol    ENABLED  ACTIVE   20989653 STRIPE    7/128    RW
sd cuddle-f0-01 stripevol-01 cuddle-f0 0       2998485  0/0       c1t0d0   ENA
sd cuddle-f1-01 stripevol-01 cuddle-f1 0       2998485  1/0       c1t1d0   ENA
sd cuddle-f2-01 stripevol-01 cuddle-f2 0       2998485  2/0       c1t2d0   ENA
sd cuddle-f3-01 stripevol-01 cuddle-f3 0       2998485  3/0       c1t3d0   ENA
sd cuddle-f4-01 stripevol-01 cuddle-f4 0       2998485  4/0       c1t4d0   ENA
sd cuddle-f5-01 stripevol-01 cuddle-f5 0       2998485  5/0       c1t5d0   ENA
sd cuddle-f6-01 stripevol-01 cuddle-f6 0       2998485  6/0       c1t6d0   ENA
# vxassist -g cuddledg mirror stripevol
# vxprint -g cuddledg -hrt stripevol
        (... removed ...)
v  stripevol    fsgen        ENABLED  ACTIVE   20971520 SELECT    -
pl stripevol-01 stripevol    ENABLED  ACTIVE   20989653 STRIPE    7/128    RW
sd cuddle-f0-01 stripevol-01 cuddle-f0 0       2998485  0/0       c1t0d0   ENA
sd cuddle-f1-01 stripevol-01 cuddle-f1 0       2998485  1/0       c1t1d0   ENA
sd cuddle-f2-01 stripevol-01 cuddle-f2 0       2998485  2/0       c1t2d0   ENA
sd cuddle-f3-01 stripevol-01 cuddle-f3 0       2998485  3/0       c1t3d0   ENA
sd cuddle-f4-01 stripevol-01 cuddle-f4 0       2998485  4/0       c1t4d0   ENA
sd cuddle-f5-01 stripevol-01 cuddle-f5 0       2998485  5/0       c1t5d0   ENA
sd cuddle-f6-01 stripevol-01 cuddle-f6 0       2998485  6/0       c1t6d0   ENA
pl stripevol-02 stripevol    ENABLED  ACTIVE   20989653 STRIPE    7/128    RW
sd cuddle-r0-01 stripevol-02 cuddle-r0 0       2998485  0/0       c1t16d0  ENA
sd cuddle-r1-01 stripevol-02 cuddle-r1 0       2998485  1/0       c1t17d0  ENA
sd cuddle-r2-01 stripevol-02 cuddle-r2 0       2998485  2/0       c1t18d0  ENA
sd cuddle-r3-01 stripevol-02 cuddle-r3 0       2998485  3/0       c1t19d0  ENA
sd cuddle-r4-01 stripevol-02 cuddle-r4 0       2998485  4/0       c1t20d0  ENA
sd cuddle-r5-01 stripevol-02 cuddle-r5 0       2998485  5/0       c1t21d0  ENA
sd cuddle-r6-01 stripevol-02 cuddle-r6 0       2998485  6/0       c1t22d0  ENA
#

There are two important things to note about creating mirrored volumes. The first is that creating them takes a very very long time. In the example above (where we created a 10G mirrored volume) it took over 20 minutes for my little Ultra1 just to sync the mirrors. You might say to yourself, however, "hey, it's a new volume, and therefore there is no data, and therefore there is nothing to sync!". Well, the logic is sound, but VxVM does in fact mirror it. There might be nothing in the volumes, but that nothingness is mirrored to the bit! The second thing to note is that in VxVM 3.x you should create simple mirrored volumes using the layout type "mirror-concat" and not simply "mirror". If you do define the layout as "mirror" you will get a "concat-mirror" not a "mirror-concat". The diffrence is that a "concat-mirror" is a type of layered volume (also known as ConcatPro), a type of volume that is beyond the scope of this course. You can find out more in the Cuddletech Kourse: Exploring Layered Volumes. But at this point just know that if you descide to use layout "mirror" with multiple disks you won't get what you might have ordere. This problem does not exsist in VxVM 2.x, since layered volumes weren't supported untill 3.x.

Let's look at one more example, taking a quick look at building a volume directly into a "mirror-stripe" layout. This will make a volume that looks very similar to the example above where we created a stripe and mirrored that stripe, except that we're going to do it together. And for this example let's also get alittle more specific, since the 7 disk stripe for a 10g volume wasn't what I had in mind:

# vxassist -g cuddledg -U fsgen make raid01-test 10g layout=mirror-stripe \
ncolumns=3 stwidth=64k nmirror=2	
# vxprint -g cuddledg -hrt raid01-test
	(... removed ...)
v  raid01-test  fsgen        ENABLED  ACTIVE   20971520 SELECT    -
pl raid01-test-01 raid01-test ENABLED ACTIVE   20975165 STRIPE    3/128    RW
sd cuddle-f0-01 raid01-test-01 cuddle-f0 0     6991677  0/0       c1t0d0   ENA
sd cuddle-f1-01 raid01-test-01 cuddle-f1 0     6991677  1/0       c1t1d0   ENA
sd cuddle-f2-01 raid01-test-01 cuddle-f2 0     6991677  2/0       c1t2d0   ENA
pl raid01-test-02 raid01-test ENABLED ACTIVE   20975165 STRIPE    3/128    RW
sd cuddle-f3-01 raid01-test-02 cuddle-f3 0     6991677  0/0       c1t3d0   ENA
sd cuddle-f4-01 raid01-test-02 cuddle-f4 0     6991677  1/0       c1t4d0   ENA
sd cuddle-f5-01 raid01-test-02 cuddle-f5 0     6991677  2/0       c1t5d0   ENA
#

That's alittle more like it. I got what I wanted, and I didn't care which disks it used, so by not specifying the vmdisks I left it to the VM to descide. If I had wanted to specified the disks I would have needed to specify 6 vmdisk's, the first 3 vmdisks would be one plex, the other 3 vmdisks would be the second plex. Also, something that can be confusing at times is the "nmirror" option I tossed in the last example. You might be tempted to think "nmirror is set to 2, therefore there should be 2 mirrors plus the data, so that's 3 plexes!", which is wrong. Start chanting "a plex is a mirror" over and over again. Setting "nmirror" to 2 means we get 2 plexes.

The options are staying the same, the syntax isn't changing, but we're building bigger, better, and kooler volumes! Now that we've covered Simple RAIDs, RAID0, RAID0+1, and RAID1 let's move on to something that isn't advisable to do by hand via vxmake (it's arguable whether you can actually manually do it, in fact, few people would even bother to try), building RAID5 volumes.