]> arthur.barton.de Git - ax-linux.git/commitdiff
Add lvm-pvclear script
authorAlexander Barton <alex@barton.de>
Sat, 12 Apr 2014 14:15:54 +0000 (16:15 +0200)
committerAlexander Barton <alex@barton.de>
Sat, 12 Apr 2014 14:24:53 +0000 (16:24 +0200)
Makefile
lvm/Makefile [new file with mode: 0644]
lvm/pvclear/Makefile [new file with mode: 0644]
lvm/pvclear/lvm-pvclear [new file with mode: 0755]

index 89cb1776edc8a8c8d6fd0b2a1d23c2a20c31da88..c367987ea5adf8b3fa361a5862ba6314b7ea4d03 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 #
 # ax-linux: Alex' Linux Tools & Scripts
-# Copyright (c)2013 Alexander Barton (alex@barton.de)
+# Copyright (c)2013-2014 Alexander Barton (alex@barton.de)
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -8,7 +8,7 @@
 # (at your option) any later version.
 #
 
-SUBDIRS = btrfs
+SUBDIRS = btrfs lvm
 
 all: $(SUBDIRS)
 
diff --git a/lvm/Makefile b/lvm/Makefile
new file mode 100644 (file)
index 0000000..32590b9
--- /dev/null
@@ -0,0 +1,15 @@
+#
+# ax-linux: Alex' Linux Tools & Scripts
+# Copyright (c)2013 Alexander Barton (alex@barton.de)
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+
+SUBDIRS = pvclear
+
+all: $(SUBDIRS)
+
+include ../Makefile.ax
diff --git a/lvm/pvclear/Makefile b/lvm/pvclear/Makefile
new file mode 100644 (file)
index 0000000..2de7213
--- /dev/null
@@ -0,0 +1,19 @@
+#
+# ax-linux: Alex' Linux Tools & Scripts
+# Copyright (c)2013 Alexander Barton (alex@barton.de)
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+
+all: lvm-pvclear
+
+install-local: lvm-pvclear
+       install -d -o $(USER) -g $(GROUP) -m 755 \
+        $(DESTDIR)/usr/local/sbin
+       install -p -o $(USER) -g $(GROUP) -m 755 lvm-pvclear \
+        $(DESTDIR)/usr/local/sbin/lvm-pvclear
+
+include ../../Makefile.ax
diff --git a/lvm/pvclear/lvm-pvclear b/lvm/pvclear/lvm-pvclear
new file mode 100755 (executable)
index 0000000..85137db
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/bash -e
+#
+# lvm-pvclear -- Clear LVM physical volume
+# Copyright (c)2013 Alexander Barton (alex@barton.de)
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+
+NAME=`basename "$0"`
+
+function Usage()
+{
+       echo "Usage: $NAME <pv>"
+       echo; exit 1
+}
+
+[ $# -eq 1 ] || Usage
+
+lvids=`lvs --noheadings -o name`
+
+for lv in $lvids; do
+       echo "Moving LV \"$lv\" ..."
+       nice ionice -c3 pvmove -i300 -n "$lv" "$1"
+       sync; sleep 2
+done