Skip to content

Commit 0ca374d

Browse files
Run udevadm settle after running parted
It seems that parted can force a partition scan (observed on a removable USB disk), which temporaly clears the filesystem labels from lsblk output. To prevent this, call udevadm settle to wait until all udev events are processed before continuing.
1 parent 2f062a9 commit 0ca374d

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. Wait for kernel/udev to be done processing.
697+
udevadm settle
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. Wait for kernel/udev to be done processing.
1146+
udevadm settle
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)