Skip to content

Commit 06abdd4

Browse files
Use lsblk to show all FS labels
Previously, e2label was used, but that only works for ext partitions. Using lsblk allows showing the filesystem labels for all filesystems supported by the kernel.
1 parent 07f536e commit 06abdd4

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

rpi-clone

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -739,13 +739,10 @@ do
739739
src_name[p]="${src_mounted_dir[p]}"
740740
fi
741741

742-
if [[ "$part_type" == *"ext"* ]]
742+
label=`lsblk --raw --output label --noheadings "${src_device[p]}"`
743+
if [ "$label" != "" ]
743744
then
744-
label=`e2label ${src_device[p]} 2> /dev/null`
745-
if [ "$label" != "" ]
746-
then
747-
src_label[p]="$label"
748-
fi
745+
src_label[p]="$label"
749746
fi
750747
done
751748

@@ -1139,16 +1136,15 @@ do
11391136
if [[ "$part_type" == *"linux-swap"* ]]
11401137
then
11411138
dst_fs_type[p]="swap"
1142-
elif [[ "$part_type" == *"ext"* ]]
1139+
elif ((p == ext_num))
11431140
then
1144-
label=`e2label ${dst_device[p]} 2> /dev/null`
1141+
dst_fs_type[p]="EXT"
1142+
else
1143+
label=`lsblk --raw --output label --noheadings "${dst_device[p]}"`
11451144
if [ "$label" != "" ]
11461145
then
11471146
dst_label[p]="$label"
11481147
fi
1149-
elif ((p == ext_num))
1150-
then
1151-
dst_fs_type[p]="EXT"
11521148
fi
11531149
done
11541150

0 commit comments

Comments
 (0)