From 37ff02a265dd82f4cbaec1b1a1ef85fd0af69c49 Mon Sep 17 00:00:00 2001 From: John Ogness Date: Fri, 23 Feb 2018 16:25:23 +0100 Subject: dd-multi.sh: wait for new partitions There is a latency between when partprobe is called and when udev actually creates the device nodes. Wait for the desired device nodes to appear before continuing. Signed-off-by: John Ogness --- lx-trainer-vm/dd-multi.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lx-trainer-vm/dd-multi.sh b/lx-trainer-vm/dd-multi.sh index 2049be8..2408a66 100755 --- a/lx-trainer-vm/dd-multi.sh +++ b/lx-trainer-vm/dd-multi.sh @@ -73,11 +73,18 @@ partprobe $DESTS for dest in $DESTS; do /bin/echo -e "n\np\n\n\n\nw" | fdisk $dest done -sync # rescan devices partprobe $DESTS +# wait for partitions to appear +for dest in $DESTS; do + while [ ! -b ${dest}2 ]; do + echo "waiting for ${dest}2..." + sleep 1 + done +done + # create ext4 on 2nd partition for dest in $DESTS; do mkfs.ext4 -L lxhome ${dest}2 & -- cgit v1.2.3