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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Lukas Czerner <lczerner@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

_______________________________________________
linux-lvm mailing list
linux-lvm@redhat.com
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/


[Index of Archives]     [Gluster Users]     [Kernel Development]     [Linux Clusters]     [Device Mapper]     [Security]     [Bugtraq]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]

  Powered by Linux