From: Silvio Rhatto Date: Mon, 8 Aug 2011 22:41:04 +0000 (-0300) Subject: Creating disk volumes just if needed X-Git-Tag: 0.1~319 X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=f5dff063011a91109085beb743d94c653b08a9c7;p=hydra.git Creating disk volumes just if needed --- diff --git a/share/hydractl/provision b/share/hydractl/provision index 309e430..1c1c9b9 100755 --- a/share/hydractl/provision +++ b/share/hydractl/provision @@ -48,9 +48,22 @@ read answer # Create volumes. echo "Creating the needed disk volumes..." -pvcreate "$device"3 -vgcreate $vg "$device"3 -lvcreate -L20G -n root $vg + +if ! pvdisplay "$device"3 &> /dev/null; then + echo "Creating physical volume..." + pvcreate "$device"3 +fi + +if ! vgdisplay $vg &> /dev/null; then + echo "Creating volume group..." + vgcreate $vg "$device"3 +fi + +if ! lvdisplay $vg/root &> /dev/null; then + echo "Creating logical volume..." + lvcreate -L20G -n root $vg +fi + vgchange -a y $vg # Garbage.