#
# 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
# (at your option) any later version.
#
-SUBDIRS = btrfs
+SUBDIRS = btrfs lvm
all: $(SUBDIRS)
--- /dev/null
+#
+# 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
--- /dev/null
+#
+# 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
--- /dev/null
+#!/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