VxVM Tutorials
Let us now see different volume layouts that can be created in veritas volume manager. Before diving deep into the RAID levels first create a Disk group with 4 disks. To do this we have to initialize 4 disks to take them under VxVM control.
# vxdisksetup -i c1t2d0 # vxdisksetup -i c1t3d0 # vxdisksetup -i c1t4d0 # vxdisksetup -i c1t5d0
After this create the disk group mydg with these four disks by naming them from disk01 through disk04.
# vxdg init mydg disk01=c1t2d0 disk02=c1t3d0 disk03=c1t4d0 disk04=c1t5d0
To confirm the disk group creation check the disks in the disk group mydg:
bash-3.2# vxdg list NAME STATE ID mydg enabled,cds 1381727926.26.geeklab
# vxprint -dg mydg TY NAME ASSOC KSTATE LENGTH PLOFFS STATE TUTIL0 PUTIL0 dm disk01 c1t2d0s2 - 2027168 - - - - dm disk02 c1t3d0s2 - 2027168 - - - - dm disk03 c1t4d0s2 - 2027168 - - - - dm disk04 c1t5d0s2 - 2027168 - - - -
Concatenated Volume
As shown in the diagram below, in RAID 0 concat volume data is first written linearly in disk01 and then to disk02. Number of subdisks in a concat volume depends upon the size of the volume. IF you have a volume greater than the size of a physical disk you would have a single sub disk on one physical disk and another sub disk on the next physical disk. Remember that the number of sub disks also depend on other factors too. The disadvantage of concat volume is that, it does not provide any redundancy to the data as we always have only one copy of data at a time. Minimum disks required to create a concat volume is 1. Command to create a concat volume :
# vxassist -g mydg make myvol 1g
To print the layout of myvol :
# vxprint -g mydg -htr ......... dg mydg default default 21000 1381665024.24.geeklab dm disk01 c1t2d0s2 auto 65536 2027168 - dm disk02 c1t3d0s2 auto 65536 2027168 - dm disk03 c1t4d0s2 auto 65536 2027168 - dm disk04 c1t5d0s2 auto 65536 2027168 - v myvol - ENABLED ACTIVE 2097152 SELECT - fsgen pl myvol-01 myvol ENABLED ACTIVE 2097152 CONCAT - RW sd disk01-01 myvol-01 disk01 0 2027168 0 c1t2d0 ENA sd disk02-01 myvol-01 disk02 0 69984 2027168 c1t3d0 ENA
RAID 0 (striped volume)
In this case we spread the data out to multiple disk by creating equal sized columns on each disk. Each column will be on a separate disk. Similar to concat volume a stripped volume also do not provide any redundancy to the data as it has only one copy of data at any point in time. To create a stripped volume you need atleast2 disks.
# vxassist -g mydg make myvol 1g layout=stripe disk01 disk02
# vxprint -g mydg -htr ........... dg mydg default default 21000 1381665024.24.geeklab dm disk01 c1t2d0s2 auto 65536 2027168 - dm disk02 c1t3d0s2 auto 65536 2027168 - dm disk03 c1t4d0s2 auto 65536 2027168 - dm disk04 c1t5d0s2 auto 65536 2027168 - v myvol - ENABLED ACTIVE 2097152 SELECT myvol-01 fsgen pl myvol-01 myvol ENABLED ACTIVE 2097152 STRIPE 2/128 RW sd disk01-01 myvol-01 disk01 0 1048576 0/0 c1t2d0 ENA sd disk02-01 myvol-01 disk02 0 1048576 1/0 c1t3d0 ENA
Now you can specify how many columns you need to stripe out the data. Also you can mention the stripe unit.
# vxassist -g mydg make myvol 1g layout=stripe ncol=2 stripeunit=256k
# vxprint -g mydg -htr .......... dg mydg default default 21000 1381665024.24.geeklab dm disk01 c1t2d0s2 auto 65536 2027168 - dm disk02 c1t3d0s2 auto 65536 2027168 - dm disk03 c1t4d0s2 auto 65536 2027168 - dm disk04 c1t5d0s2 auto 65536 2027168 - v myvol - ENABLED ACTIVE 2097152 SELECT myvol-01 fsgen pl myvol-01 myvol ENABLED ACTIVE 2097152 STRIPE 2/512 RW sd disk01-01 myvol-01 disk01 0 1048576 0/0 c1t2d0 ENA sd disk02-01 myvol-01 disk02 0 1048576 1/0 c1t3d0 ENA
Mirrored layout (RAID 1)
Mirrored layout or RAID 1 layout is one of the most commonly used layout in production environments. RAID 1 simply mirrors all the data from one disk to another so that we have an extra copy of data. This provides us the necessary data redundancy. Here each plex is on a different disk. Command to create a RAID 1 mirrored volume is :
# vxassist -g mydg make myvol 20m layout=mirror disk01 disk02
To check the layout of a RAID 1 mirrored volume :
# vxprint -g mydg -htr ............. dg mydg default default 21000 1381665024.24.geeklab dm disk01 c1t2d0s2 auto 65536 2027168 - dm disk02 c1t3d0s2 auto 65536 2027168 - dm disk03 c1t4d0s2 auto 65536 2027168 - dm disk04 c1t5d0s2 auto 65536 2027168 - v myvol - ENABLED ACTIVE 40960 SELECT - fsgen pl myvol-01 myvol ENABLED ACTIVE 40960 CONCAT - RW sd disk01-01 myvol-01 disk01 0 40960 0 c1t2d0 ENA pl myvol-02 myvol ENABLED ACTIVE 40960 CONCAT - RW sd disk02-01 myvol-02 disk02 0 40960 0 c1t3d0 ENA
RAID 5
In case of RAID 5 volumes a parity information is stored on every disk as shown in the diagram. Now this parity can be used in case you want to recover the data lost due to a disk failure. The parity is spread across all the disk to ensure that we have sufficient copies of parity all the time. We need atleast 3 disks to create a RAID 5 volume. Command to create a RAID 5 volume is :
# vxassist -g mydg make myvol 1200m layout=raid5
To check the layout of a RAID 5 volume :
# vxprint -g mydg -htr ........... dg mydg default default 12000 1381727926.26.geeklab dm disk01 c1t2d0s2 auto 65536 2027168 - dm disk02 c1t3d0s2 auto 65536 2027168 - dm disk03 c1t4d0s2 auto 65536 2027168 - dm disk04 c1t5d0s2 auto 65536 2027168 - v myvol - ENABLED ACTIVE 2457600 RAID - raid5 pl myvol-01 myvol ENABLED ACTIVE 2457600 RAID 3/32 RW sd disk01-01 myvol-01 disk01 0 1228800 0/0 c1t2d0 ENA sd disk02-01 myvol-01 disk02 0 1228800 1/0 c1t3d0 ENA sd disk03-01 myvol-01 disk03 0 1228800 2/0 c1t4d0 ENA pl myvol-02 myvol ENABLED LOG 2880 CONCAT - RW sd disk04-01 myvol-02 disk04 0 2880 0 c1t5d0 ENA
Advantages and disadvantages of various RAID levels
Concat | RAID 0 (striping) | RAID 1 (Mirror) | RAID 5 | |
---|---|---|---|---|
Advantages | 1. Easy to administer2. Maximum utilization of disk space3. Any size disks can be added to create volumes. | 1. Parallel data transfer to improve write speed. | 1. Protection against disk failure2. Faster write performance | 1. More usable disk space than mirroring2. Redundant3. Fast read4. Faster recovery through parity. |
Disadvantages | 1. No redundancy | 1. No redundancy | 1. Requires more disks to configure2. A bit slow write performance. | 1. Slow write due to parity.2. Poor performance after disk failure. |
Mirror-stripe (RAID 1+0)
In case of a stripe mirror the data is first mirrored and then the mirrored data is striped as shown in the diagram. This requires atleast 4 disk. Command to create a mirror-stripe is :
# vxassist -g mydg make myvol 20m layout=mirror-stripe ncol=2 bash-3.2
To print the layout of a mirror-stripe volume :
# vxprint -g mydg -htr ........ dg mydg default default 21000 1381665024.24.geeklab dm disk01 c1t2d0s2 auto 65536 2027168 - dm disk02 c1t3d0s2 auto 65536 2027168 - dm disk03 c1t4d0s2 auto 65536 2027168 - dm disk04 c1t5d0s2 auto 65536 2027168 - v myvol - ENABLED ACTIVE 40960 SELECT - fsgen pl myvol-01 myvol ENABLED ACTIVE 40960 STRIPE 2/128 RW sd disk01-01 myvol-01 disk01 0 20480 0/0 c1t2d0 ENA sd disk02-01 myvol-01 disk02 0 20480 1/0 c1t3d0 ENA pl myvol-02 myvol ENABLED ACTIVE 40960 STRIPE 2/128 RW sd disk03-01 myvol-02 disk03 0 20480 0/0 c1t4d0 ENA sd disk04-01 myvol-02 disk04 0 20480 1/0 c1t5d0 ENA
Mirror-concat (RAID 0+1)
Now in case of a mirror-concat volume, the data is first concatenated and then this concatenated data is mirrored as shown in the diagram. This requires atleast 4 disks. To create a mirror-concat volume :
# vxassist -g mydg make myvol 1200m layout=mirror-concat
To print the layout of a mirror-concat volume :
# vxprint -g mydg -htr ........... dg mydg default default 21000 1381665024.24.geeklab dm disk01 c1t2d0s2 auto 65536 2027168 - dm disk02 c1t3d0s2 auto 65536 2027168 - dm disk03 c1t4d0s2 auto 65536 2027168 - dm disk04 c1t5d0s2 auto 65536 2027168 - v myvol - ENABLED ACTIVE 2457600 SELECT - fsgen pl myvol-01 myvol ENABLED ACTIVE 2457600 CONCAT - RW sd disk01-01 myvol-01 disk01 0 2027168 0 c1t2d0 ENA sd disk03-01 myvol-01 disk03 0 430432 2027168 c1t4d0 ENA pl myvol-02 myvol ENABLED ACTIVE 2457600 CONCAT - RW sd disk02-01 myvol-02 disk02 0 2027168 0 c1t3d0 ENA sd disk04-01 myvol-02 disk04 0 430432 2027168 c1t5d0 ENA
Comparisons of various RAID levels
concat | stripe (RAID 0) | mirror (RAID 1) | RAID 5 | RAID 1+0 and RAID 0+1 | |
---|---|---|---|---|---|
Minimum number of Disks required | 1 | 2 | 2 | 3 | 4 |
Data Protection | no | no | yes | yes | yes |
Disk space usage (Using minimum number of disks) | 100% | 100% | 50% | 67% | 50% |
Read performance | High | High | High | High | High |
Write performance | High | High | Medium | Low | Medium |
Layered volumes
Layered volumes are actually built on top of other volumes. In layered volumes data is mirrored at sub disk level which brings in more granularity. Now to do this VxVM creates sub volumes from traditional volumes. Advantages 1. Faster recovery from failure than RAID 1+0 and RAID 0+1 2. Can persist more disk failures than RAID 1+0 and RAID 0+1 Disadvantage 1. Requires more VxVM objects ( sub volumes are required for a layered volume)
1. concat-mirror
In case of concat-mirror, sub disks are concatenated to create the plexes for the sub volumes. The sub volumes are the mirrored to create the top level plex and eventually top level volume. Advantage Recovery is faster as each portion of concatenation is mirrored separately Command to create a concat-mirror volume :
# vxassist -g mydg make myvol 1200m layout=concat-mirror
Check the layout of the volume we just created. You should see 2 subvolumes with 2 volumes each. Each volume will have one plex with one sub-disk.
# vxprint -g mydg -htr ............. dg mydg default default 21000 1381665024.24.geeklab dm disk01 c1t2d0s2 auto 65536 2027168 - dm disk02 c1t3d0s2 auto 65536 2027168 - dm disk03 c1t4d0s2 auto 65536 2027168 - dm disk04 c1t5d0s2 auto 65536 2027168 - v myvol - ENABLED ACTIVE 2457600 SELECT - fsgen pl myvol-03 myvol ENABLED ACTIVE 2457600 CONCAT - RW sv myvol-S01 myvol-03 myvol-L01 1 2027168 0 2/2 ENA v2 myvol-L01 - ENABLED ACTIVE 2027168 SELECT - fsgen p2 myvol-P01 myvol-L01 ENABLED ACTIVE 2027168 CONCAT - RW s2 disk01-02 myvol-P01 disk01 0 2027168 0 c1t2d0 ENA p2 myvol-P02 myvol-L01 ENABLED ACTIVE 2027168 CONCAT - RW s2 disk02-02 myvol-P02 disk02 0 2027168 0 c1t3d0 ENA sv myvol-S02 myvol-03 myvol-L02 1 430432 2027168 2/2 ENA v2 myvol-L02 - ENABLED ACTIVE 430432 SELECT - fsgen p2 myvol-P03 myvol-L02 ENABLED ACTIVE 430432 CONCAT - RW s2 disk03-02 myvol-P03 disk03 0 430432 0 c1t4d0 ENA p2 myvol-P04 myvol-L02 ENABLED ACTIVE 430432 CONCAT - RW s2 disk04-02 myvol-P04 disk04 0 430432 0 c1t5d0 ENA
2. stripe-mirror
In case of stripe-mirror, sub disks are mirrored to create the plexes for the sub volumes. The sub volumes are then striped to create the top level plex and eventually a top level volume. Advantage More tolerant to faults, as each stripe is mirrored separately. Command to create a stripe-mirror volume :
# vxassist -g mydg make myvol 1200m layout=stripe-mirror
Check the layout of the volume we just created. You should see 2 subvolumes with 2 volumes each. Each volume will have one plex with one sub-disk.
# vxprint -g mydg -htr .............. dg mydg default default 21000 1381665024.24.geeklab dm disk01 c1t2d0s2 auto 65536 2027168 - dm disk02 c1t3d0s2 auto 65536 2027168 - dm disk03 c1t4d0s2 auto 65536 2027168 - dm disk04 c1t5d0s2 auto 65536 2027168 - v myvol - ENABLED ACTIVE 2457600 SELECT myvol-03 fsgen pl myvol-03 myvol ENABLED ACTIVE 2457600 STRIPE 2/128 RW sv myvol-S01 myvol-03 myvol-L01 1 1228800 0/0 2/2 ENA v2 myvol-L01 - ENABLED ACTIVE 1228800 SELECT - fsgen p2 myvol-P01 myvol-L01 ENABLED ACTIVE 1228800 CONCAT - RW s2 disk01-02 myvol-P01 disk01 0 1228800 0 c1t2d0 ENA p2 myvol-P02 myvol-L01 ENABLED ACTIVE 1228800 CONCAT - RW s2 disk03-02 myvol-P02 disk03 0 1228800 0 c1t4d0 ENA sv myvol-S02 myvol-03 myvol-L02 1 1228800 1/0 2/2 ENA v2 myvol-L02 - ENABLED ACTIVE 1228800 SELECT - fsgen p2 myvol-P03 myvol-L02 ENABLED ACTIVE 1228800 CONCAT - RW s2 disk02-02 myvol-P03 disk02 0 1228800 0 c1t3d0 ENA p2 myvol-P04 myvol-L02 ENABLED ACTIVE 1228800 CONCAT - RW s2 disk04-02 myvol-P04 disk04 0 1228800 0 c1t5d0 ENA
I hope the post was informative, Do subscribe to stay updated.