Skip to content

Commit 145200d

Browse files
Sleep after running parted
It seems that parted can force a partition scan, seen on a removable USB disk. As a simple workaround, just sleep for a second after running parted.
1 parent 2f062a9 commit 145200d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

rpi-clone

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,9 @@ fi
692692
#
693693
src_partition_table=$(parted --script -m "/dev/$src_disk" unit s print | tr -d ';')
694694
src_fdisk_table=$(fdisk -l /dev/$src_disk | grep "^/dev/")
695+
# Parted seems to force a partition rescan, which hides fs labels from
696+
# lsblk output. Sleeping a bit to wait for that is rough, but works.
697+
sleep 1;
695698

696699
tmp=$(df | grep -e "^/dev/$src_disk" -e "^/dev/root" -e "$src_root_dev" \
697700
| tr -s " ")
@@ -1138,6 +1141,10 @@ then
11381141
fi
11391142

11401143
dst_partition_table=$(parted --script -m "/dev/$dst_disk" unit s print | tr -d ';')
1144+
# Parted seems to force a partition rescan, which hides fs labels from
1145+
# lsblk output. Sleeping a bit to wait for that is rough, but works.
1146+
sleep 1;
1147+
11411148
n_dst_parts=$(echo "$dst_partition_table" | tail -n 1 | cut -d ":" -f 1)
11421149
if [ "$n_dst_parts" == "/dev/$dst_disk" ]
11431150
then

0 commit comments

Comments
 (0)