]> arthur.barton.de Git - ax-linux.git/blob - lvm/pvclear/lvm-pvclear
Add lvm-pvclear script
[ax-linux.git] / lvm / pvclear / lvm-pvclear
1 #!/bin/bash -e
2 #
3 # lvm-pvclear -- Clear LVM physical volume
4 # Copyright (c)2013 Alexander Barton (alex@barton.de)
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 #
11
12 NAME=`basename "$0"`
13
14 function Usage()
15 {
16         echo "Usage: $NAME <pv>"
17         echo; exit 1
18 }
19
20 [ $# -eq 1 ] || Usage
21
22 lvids=`lvs --noheadings -o name`
23
24 for lv in $lvids; do
25         echo "Moving LV \"$lv\" ..."
26         nice ionice -c3 pvmove -i300 -n "$lv" "$1"
27         sync; sleep 2
28 done