[Fedora-livecd-list] [PATCH] livecd-iso-to-disk --format fails with existing LV on USB
David Huff
dhuff at redhat.com
Thu Apr 22 17:03:22 UTC 2010
Resolves rhbz#583658
---
tools/livecd-iso-to-disk.sh | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index 3a4726d..0cfcfb8 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -138,6 +138,21 @@ checkPartActive() {
fi
}
+checkLVMActive() {
+ dev=$1
+
+ # check for an active lv which will cause format to fail
+ for vg in $(pvs -o vg_name --noheadings $dev $dev${dev_delim}[0-9]* 2>/dev/null|sort -u); do
+ if [ $(lvs -o lv_attr --noheadings $vg |awk {'print $1;'} |cut -c 5) = "a" ]; then
+ echo "Device, $dev, contains a volume group with an active volume and cannot be formated!"
+ echo "You can remove the volume group with "
+ echo " # /sbin/vgremove -f $vg"
+ exitclean
+ fi
+ done
+ return 0
+}
+
createGPTLayout() {
dev=$1
getdisk $dev
@@ -407,6 +422,7 @@ fi
# do some basic sanity checks.
checkMounted $USBDEV
if [ -n "$format" ];then
+ checkLVMActive $USBDEV
# checks for a valid filesystem
if [ -n "$efi" ];then
createGPTLayout $USBDEV
--
1.6.6.1
More information about the livecd
mailing list