Sync usage with man page.
[netbsd-mini2440.git] / external / gpl2 / lvm2 / dist / test / t-vgreduce-usage.sh
blob7660e9414cff4dc6a6fdf05ab6620cecf82ac210
1 #!/bin/sh
2 # Copyright (C) 2008 Red Hat, Inc. All rights reserved.
4 # This copyrighted material is made available to anyone wishing to use,
5 # modify, copy, or redistribute it subject to the terms and conditions
6 # of the GNU General Public License v.2.
8 # You should have received a copy of the GNU General Public License
9 # along with this program; if not, write to the Free Software Foundation,
10 # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
12 . ./test-utils.sh
14 aux prepare_devs 4
16 for mdatype in 1 2
18 # setup PVs
19 pvcreate -M$mdatype $dev1 $dev2
21 # (lvm$mdatype) vgreduce removes only the specified pv from vg (bz427382)" '
22 vgcreate -M$mdatype $vg1 $dev1 $dev2
23 vgreduce $vg1 $dev1
24 check_pv_field_ $dev2 vg_name $vg1
25 vgremove -f $vg1
27 # (lvm$mdatype) vgreduce rejects removing the last pv (--all)
28 vgcreate -M$mdatype $vg1 $dev1 $dev2
29 not vgreduce --all $vg1
30 vgremove -f $vg1
32 # (lvm$mdatype) vgreduce rejects removing the last pv
33 vgcreate -M$mdatype $vg1 $dev1 $dev2
34 not vgreduce $vg1 $dev1 $dev2
35 vgremove -f $vg1
37 pvremove -ff $dev1 $dev2
38 done
40 mdatype=2 # we only expect the following to work for lvm2 metadata
42 # (lvm$mdatype) setup PVs (--metadatacopies 0)
43 pvcreate -M$mdatype $dev1 $dev2
44 pvcreate --metadatacopies 0 -M$mdatype $dev3 $dev4
46 # (lvm$mdatype) vgreduce rejects removing pv with the last mda copy (bz247448)
47 vgcreate -M$mdatype $vg1 $dev1 $dev3
48 not vgreduce $vg1 $dev1
49 vgremove -f $vg1
51 #COMM "(lvm$mdatype) vgreduce --removemissing --force repares to linear (bz221921)"
52 # (lvm$mdatype) setup: create mirror & damage one pv
53 vgcreate -M$mdatype $vg1 $dev1 $dev2 $dev3
54 lvcreate -n $lv1 -m1 -l 4 $vg1
55 lvcreate -n $lv2 -l 4 $vg1 $dev2
56 lvcreate -n $lv3 -l 4 $vg1 $dev3
57 vgchange -an $vg1
58 aux disable_dev $dev1
59 # (lvm$mdatype) vgreduce --removemissing --force repares to linear
60 vgreduce --removemissing --force $vg1
61 check_lv_field_ $vg1/$lv1 segtype linear
62 vg_validate_pvlv_counts_ $vg1 2 3 0
63 # cleanup
64 aux enable_dev $dev1
65 vgremove -ff $vg1
67 #COMM "vgreduce rejects --removemissing --mirrorsonly --force when nonmirror lv lost too"
68 # (lvm$mdatype) setup: create mirror + linear lvs
69 vgcreate -M$mdatype $vg1 $devs
70 lvcreate -n $lv2 -l 4 $vg1
71 lvcreate -m1 -n $lv1 -l 4 $vg1 $dev1 $dev2 $dev3
72 lvcreate -n $lv3 -l 4 $vg1 $dev3
73 pvs --segments -o +lv_name # for record only
74 # (lvm$mdatype) setup: damage one pv
75 vgchange -an $vg1
76 aux disable_dev $dev1
77 #pvcreate -ff -y $dev1
78 # vgreduce rejects --removemissing --mirrorsonly --force when nonmirror lv lost too
79 not vgreduce --removemissing --mirrorsonly --force $vg1
81 aux enable_dev $dev1
83 pvs -P # for record
84 lvs -P # for record
85 vgs -P # for record