VxVM的底层建卷

vxmake从底层做卷,比起用vxassist直接卷,更具有挑战性,更能够帮助我们理解VxVM卷的结构!

例1:做镜像,步骤是先做两子磁盘和plex,再镜像两plex
#vxassist make aaa 100m layout=mirror new01 new02 (raid0)

#vxmake –g new sd new01-01 new01,0,100m (子磁盘)
#vxmake –g new sd new02-01 new02,0,100m

# vxmake -g new plex aaa-01 sd=new01-01 (plex)
# vxmake -g new plex aaa-02 sd=new02-01

#vxmake –g new –U fsgen vol aaa plex=aaa-01 (关联vol)
#vxplex att aaa aaa-01

#vxvol start aaa (起动vol)
#newfs /dev/vx/dsk/new/aaa
#mount /dev/vx/dsk/new/aaa /data


例2:做条带化,其中注意vxvm带的默认stwidth为64K,所以在做条带plex,一定要指定

#vxassist make aaa 100m layout=stripe new01 new02

#vxmake –g new sd new01-01 new01,0,100m (子磁盘)
#vxmake –g new sd new02-01 new02,0,100m

#vxmake -g new plex aaa-01 layout=stripe ncolumn=2 stwidth=64k sd=new01-01,new02-01

#vxmake –g new –U fsgen vol aaa plex=aaa-01
#vxvol start aaa


做个小试验,可以将stripe的子磁盘,全部打乱,再重新组合!
#vxassist make aaa 100m layout=stripe new01 new02 new03
#vxsd –f dis new01-01 (RAID子磁盘的再组合)
#vxsd –f dis new02-01
#vxsd –f dis new03-01

# vxsd -l 0 assoc aaa-01 new01-01 (结合stripe子磁盘)
# vxsd -l 2 assoc aaa-01 new03-01
# vxsd -l 1 assoc aaa-01 new02-01
#vxplex att aaa aaa-01
#vxvol start aaa



例3:raid0 1和做两个stripe差不多

#vxassit make aaa 100m layout=mirror-stripe new01 new02 new03 new04

#vxmake –g new sd new01-01 new01,0,100m (子磁盘)
#vxmake –g new sd new02-01 new02,0,100m
#vxmake –g new sd new03-01 new03,0,100m
#vxmake –g new sd new04-01 new04,0,100m

#vxmake -g new plex aaa-01 layout=stripe ncolumn=2 stwidth=64k sd=new01-01,new02-01
#vxmake –g new plex aaa-02 layout=stripe ncolumn=2 stwidth=64k sd=new03-01,new04-01

#vxmake –g new –U fsgen vol aaa plex=aaa-01 (stripe卷)
#vxplex att aaa aaa-02
#vxvol start aaa


小试验,位于卷aaa,两个条带的相对位子磁盘同时损坏,这时raid01就己经瘫痪了,唯一的办法就是把两个条带的子磁盘分离出来,再给合成一个新的卷,及时备份数据!这种操作有一定的危险性,有时重组后会无法起动卷,起动卷后卷只读,所以要格外小心!
# vxassit make aaa 100m layout=mirror-stripe new01 new02 new03 new04
#new01 new04损坏 (RAID01子磁盘重组)
#vxplex dis aaa-01
#vxsd –f dis new01-01
#vxsd –f dis new04-01

#vxmake –g new sd new01-01 new01,0,102400
#vxmake –g new sd new04-01 new04,0,103600
#vxsd –f dis new02-01
#vxsd –l 1 assoc aaa-02 new02-01 (残余子磁盘合成卷)
#vxvol –f start aaa
#vxsd mv new02-01 new04-01 (移动子磁盘)

#vxsd –l 0 assoc aaa-01 new01-01
#vxsd –l 1 assoc aaa-01 new02-01
#vxplex att aaa aaa-01 (plex再结合)

# vxassit make aaa 100m layout=mirror-stripe new01 new02 new03 new04
#vxplex dis aaa-01
#vxsd dis new02-01 (交换子磁盘)
#vxsd dis new04-01
#vxsd –l 1 assoc aaa-01 new04-01
#vxsd –l 1 assoc aaa-02 new02-01
#vxplex att aaa aaa-01

#vxmake –g new –U fsgen vol bbb plex=aaa-01
#vxvol start bbb



例4:做raid5卷,raid5也就是特殊的条带化,子磁盘同样可以分离重组
#vxassist make aaa 200m layout=raid5 new01 new02 new03 new04

#vxmake –g new sd new01-01 new01,0,100m
#vxmake –g new sd new02-01 new02,0,100m
#vxmake –g new sd new03-01 new03,0,100m

#vxmake –g new plex aaa-01 layout=raid5 ncolumn=3 stwidth=16k/ (默认16k)
sd=new01-01,new02-01,new03-01
#vxmake –g new –U raid5 vol aaa plex=aaa-01

#vxvol start aaa
#vxassist –g new addlog aaa
#newfs /dev/vx/dsk/new/aaa

#vxassist make aaa 200m layout=raid5 new01 new02 new03 new04

推荐阅读