]> gitweb.fluxo.info Git - hydra.git/commitdiff
Creating disk volumes just if needed
authorSilvio Rhatto <rhatto@riseup.net>
Mon, 8 Aug 2011 22:41:04 +0000 (19:41 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Mon, 8 Aug 2011 22:41:04 +0000 (19:41 -0300)
share/hydractl/provision

index 309e430d59c6013ce90edbfbc5335262f9bbaf7c..1c1c9b9e5d1a6baa219870b0a71a14f5f7ae43dd 100755 (executable)
@@ -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.