diff --git a/docker-storage-setup.sh b/docker-storage-setup.sh index f3ad571..091c953 100755 --- a/docker-storage-setup.sh +++ b/docker-storage-setup.sh @@ -608,12 +608,11 @@ scan_disks() { local new_disks="" for dev in $DEVS_ABS; do - local basename=$(basename $dev) - local p + local part=$(query_first_child $dev) - if is_dev_part_of_vg ${dev}1 $VG; then - Info "Device ${dev} is already partitioned and is part of volume group $VG" - continue + if [ -n "$part" ] && is_dev_part_of_vg ${part} $VG; then + Info "Device ${dev} is already partitioned and is part of volume group $VG" + continue fi # If signatures are being overridden, then simply return the disk as new @@ -623,9 +622,7 @@ scan_disks() { continue fi - # If device does not have partitions, it is a new disk requiring processing. - p=$(awk "\$4 ~ /${basename}./ {print \$4}" /proc/partitions) - if [[ -z "$p" ]]; then + if [ -z "$part" ]; then new_disks="$dev $new_disks" continue fi @@ -643,12 +640,11 @@ create_partition() { # TODO: # * Consider gpt, or unpartitioned volumes # * Error handling when partition(s) already exist - # * Deal with loop/nbd device names. See growpart code size=$(( $( awk "\$4 ~ /"$( basename $dev )"/ { print \$3 }" /proc/partitions ) * 2 - 2048 )) - cat <