Skip to content

Commit df6d278

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 4389dcf commit df6d278

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
@@ -691,6 +691,9 @@ fi
691691
#
692692
src_partition_table=$(parted --script -m "/dev/$src_disk" unit s print | tr -d ';')
693693
src_fdisk_table=$(fdisk -l /dev/$src_disk | grep "^/dev/")
694+
# Parted seems to force a partition rescan, which hides fs labels from
695+
# lsblk output. Wait for kernel/udev to be done processing.
696+
udevadm settle
694697

695698
tmp=$(df | grep -e "^/dev/$src_disk" -e "^/dev/root" -e "$src_root_dev" \
696699
| tr -s " ")
@@ -1142,6 +1145,10 @@ then
11421145
fi
11431146

11441147
dst_partition_table=$(parted --script -m "/dev/$dst_disk" unit s print | tr -d ';')
1148+
# Parted seems to force a partition rescan, which hides fs labels from
1149+
# lsblk output. Wait for kernel/udev to be done processing.
1150+
udevadm settle
1151+
11451152
n_dst_parts=$(echo "$dst_partition_table" | tail -n 1 | cut -d ":" -f 1)
11461153
if [ "$n_dst_parts" == "/dev/$dst_disk" ]
11471154
then

0 commit comments

Comments
 (0)