[linux-lvm] [PATCH 14/35] fsadm: Allow to remove all volume groups

Lukas Czerner lczerner at redhat.com
Wed Sep 21 16:45:33 UTC 2011


Add new argument to the "remove" command --all to remove all volume
groups.

Signed-off-by: Lukas Czerner <lczerner at redhat.com>
---
 scripts/fsadm.sh |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/scripts/fsadm.sh b/scripts/fsadm.sh
index 66ecf1eb..028bc04 100755
--- a/scripts/fsadm.sh
+++ b/scripts/fsadm.sh
@@ -757,7 +757,6 @@ create() {
 				vgsize=$(echo $i | sed -e 's/^ *//' | cut -d' ' -f2)
 				vgsize=${vgsize%%B}
 				if [ $vgsize -ge $new_size ]; then
-					echo "Yes"
 					vgname=$(echo $i | sed -e 's/^ *//' | cut -d' ' -f1)
 					break;
 				fi
@@ -933,11 +932,15 @@ do_remove() {
 remove() {
 	# help
 	if [ "$1" == "help" ]; then
-		echo "Usage: $TOOL remove [mount point | dm device | voulume group | device]"
+		echo "Usage: $TOOL remove [mount point | dm device | voulume group | device | --all]"
 		exit 0
+	elif [ "$1" == "--all" ]; then
+		list="$(LANG=C $LVM vgs -o vg_name --separator ' ' --noheadings --nosuffix --units b 2> /dev/null)"
+	else
+		list=$@
 	fi
 
-	for item in $@; do
+	for item in $list; do
 		do_remove $item
 	done
 
-- 
1.7.4.4




More information about the linux-lvm mailing list