xref: /dflybsd-src/contrib/lvm2/dist/test/t-lvconvert-repair.sh (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
186d7f5d3SJohn Marino#!/bin/bash
286d7f5d3SJohn Marino# Copyright (C) 2008 Red Hat, Inc. All rights reserved.
386d7f5d3SJohn Marino#
486d7f5d3SJohn Marino# This copyrighted material is made available to anyone wishing to use,
586d7f5d3SJohn Marino# modify, copy, or redistribute it subject to the terms and conditions
686d7f5d3SJohn Marino# of the GNU General Public License v.2.
786d7f5d3SJohn Marino#
886d7f5d3SJohn Marino# You should have received a copy of the GNU General Public License
986d7f5d3SJohn Marino# along with this program; if not, write to the Free Software Foundation,
1086d7f5d3SJohn Marino# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
1186d7f5d3SJohn Marino
1286d7f5d3SJohn Marino. ./test-utils.sh
1386d7f5d3SJohn Marino
1486d7f5d3SJohn Marinoprepare_vg 4
1586d7f5d3SJohn Marino
1686d7f5d3SJohn Marinovgreduce $vg $dev4
1786d7f5d3SJohn Marinolvcreate -m 1 -L 1 -n mirror $vg
1886d7f5d3SJohn Marino
1986d7f5d3SJohn Marinolvchange -a n $vg/mirror
2086d7f5d3SJohn Marinovgextend $vg $dev4
2186d7f5d3SJohn Marinodisable_dev $dev1
2286d7f5d3SJohn Marinolvchange --partial -a y $vg/mirror
2386d7f5d3SJohn Marino
2486d7f5d3SJohn Marinonot vgreduce -v --removemissing $vg
2586d7f5d3SJohn Marinolvconvert -y -i 1 --repair $vg/mirror
2686d7f5d3SJohn Marinovgreduce --removemissing $vg
2786d7f5d3SJohn Marino
2886d7f5d3SJohn Marinoenable_dev $dev1
2986d7f5d3SJohn Marinovgextend $vg $dev1
3086d7f5d3SJohn Marinodisable_dev $dev2
3186d7f5d3SJohn Marinolvconvert -y -i 1 --repair $vg/mirror
3286d7f5d3SJohn Marinovgreduce --removemissing $vg
3386d7f5d3SJohn Marino
3486d7f5d3SJohn Marinoenable_dev $dev2
3586d7f5d3SJohn Marinovgextend $vg $dev2
3686d7f5d3SJohn Marinodisable_dev $dev3
3786d7f5d3SJohn Marinolvconvert -y -i 1 --repair $vg/mirror
3886d7f5d3SJohn Marinovgreduce --removemissing $vg
3986d7f5d3SJohn Marino
4086d7f5d3SJohn Marinoenable_dev $dev3
4186d7f5d3SJohn Marinovgextend $vg $dev3
4286d7f5d3SJohn Marinolvcreate -m 2 -l 1 -n mirror2 $vg $dev1 $dev2 $dev3 $dev4
4386d7f5d3SJohn Marinovgchange -a n $vg
4486d7f5d3SJohn Marinopvremove -ff -y $dev4
4586d7f5d3SJohn Marinoecho 'y' | not lvconvert -y -i 1 --repair $vg/mirror2
4686d7f5d3SJohn Marinovgs
47