Sync usage with man page.
[netbsd-mini2440.git] / external / gpl2 / lvm2 / dist / test / t-vgextend-usage.sh
blob14d952484c8330f36d7168bad8ab3a024b875eea
1 # Copyright (C) 2008 Red Hat, Inc. All rights reserved.
3 # This copyrighted material is made available to anyone wishing to use,
4 # modify, copy, or redistribute it subject to the terms and conditions
5 # of the GNU General Public License v.2.
7 # You should have received a copy of the GNU General Public License
8 # along with this program; if not, write to the Free Software Foundation,
9 # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
12 # Exercise various vgextend commands
15 . ./test-utils.sh
17 aux prepare_devs 5
19 for mdatype in 1 2
22 # Explicit pvcreate
23 pvcreate -M$mdatype $dev1 $dev2 $dev3 $dev4 $dev5
24 vgcreate -M$mdatype $vg1 $dev1 $dev2
25 vgextend $vg1 $dev3 $dev4 $dev5
26 vgremove -ff $vg1
28 # Implicit pvcreate
29 pvremove $dev1 $dev2 $dev3 $dev4 $dev5
30 vgcreate -M$mdatype $vg1 $dev1 $dev2
31 vgextend -M$mdatype $vg1 $dev3 $dev4 $dev5
32 vgremove -ff $vg1
33 pvremove $dev1 $dev2 $dev3 $dev4 $dev5
35 done
37 # Implicit pvcreate tests, test pvcreate options on vgcreate
38 # --force, --yes, --metadata{size|copies|type}, --zero
39 # --dataalignment[offset]
40 vgcreate $vg $dev2
41 vgextend --force --yes --zero y $vg $dev1
42 vgreduce $vg $dev1
43 pvremove -f $dev1
45 for i in 0 1 2 3
47 # vgcreate (lvm2) succeeds writing LVM label at sector $i
48 vgextend --labelsector $i $vg $dev1
49 dd if=$dev1 bs=512 skip=$i count=1 2>/dev/null | strings | grep -q LABELONE;
50 vgreduce $vg $dev1
51 pvremove -f $dev1
52 done
54 # pvmetadatacopies
55 for i in 0 1 2
57 vgextend --pvmetadatacopies $i $vg $dev1
58 check_pv_field_ $dev1 pv_mda_count $i
59 vgreduce $vg $dev1
60 pvremove -f $dev1
61 done
63 # metadatasize, dataalignment, dataalignmentoffset
64 #COMM 'pvcreate sets data offset next to mda area'
65 vgextend --metadatasize 100k --dataalignment 100k $vg $dev1
66 check_pv_field_ $dev1 pe_start 200.00k
67 vgreduce $vg $dev1
68 pvremove -f $dev1
70 # data area is aligned to 64k by default,
71 # data area start is shifted by the specified alignment_offset
72 pv_align="195.50k"
73 vgextend --metadatasize 128k --dataalignmentoffset 7s $vg $dev1
74 check_pv_field_ $dev1 pe_start $pv_align
75 vgremove -f $vg
76 pvremove -f $dev1
78 # vgextend fails if pv belongs to existing vg
79 vgcreate $vg1 $dev1 $dev3
80 vgcreate $vg2 $dev2
81 not vgextend $vg2 $dev3
82 vgremove -f $vg1
83 vgremove -f $vg2
84 pvremove -f $dev1 $dev2 $dev3
86 #vgextend fails if vg is not resizeable
87 vgcreate $vg1 $dev1 $dev2
88 vgchange --resizeable n $vg1
89 not vgextend $vg1 $dev3
90 vgremove -f $vg1
91 pvremove -f $dev1 $dev2
93 # all PVs exist in the VG after extended
94 pvcreate $dev1
95 vgcreate $vg1 $dev2
96 vgextend $vg1 $dev1 $dev3
97 check_pv_field_ $dev1 vg_name $vg1
98 check_pv_field_ $dev2 vg_name $vg1
99 check_pv_field_ $dev3 vg_name $vg1
100 vgremove -f $vg1
101 pvremove -f $dev1 $dev2 $dev3