Skip to content

Commit 0afe1ef

Browse files
Fix detection of unlabeled LUKS drives as backup targets
Fixed an issue where automatic backup target detection failed for LUKS-encrypted drives without labels. The detection logic now handles unlabeled LUKS drives correctly, ensuring they are properly identified and processed.
1 parent 2c16eda commit 0afe1ef

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

pve_backup_usb.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,8 @@ do
820820
break 1
821821
else
822822
message "${message} '${luks_target}'... not found, continuing."
823+
# nothing was found (yet)
824+
luks_target=""
823825
fi
824826

825827
# label of a partition
@@ -833,16 +835,15 @@ do
833835
break 1
834836
else
835837
message "${message} '${luks_target}'... not found, continuing."
838+
# nothing was found (yet)
839+
luks_target=""
836840
fi
837841

838842
# invalid value
839843
elif [ -n "${luks_target}" ]
840844
then
841845
message "Invalid value '${luks_target}' (has to be a valid partition label or UUID, check '-d' parameter), continuing." "warning"
842846
fi
843-
844-
# nothing was found (yet)
845-
luks_target=""
846847
done
847848
# use the first partition with a "pve_backup_usb" label if no (useable) target was specified or found
848849
if [ -z "${luks_target}" ]
@@ -853,12 +854,13 @@ then
853854
message "${message} '${luks_target}'... found."
854855
else
855856
message "${message} '${luks_target}'... not found, continuing."
857+
# nothing was found (yet)
858+
luks_target=""
856859
fi
857860
fi
858861
# use the first partition of the first usb storage device if no (useable) target was specified or found
859862
if [ -z "${luks_target}" ]
860863
then
861-
862864
luks_target="/dev/$(ls -l /dev/disk/by-path/*usb*part1 | cut -f 7 -d "/" | head -n 1)"
863865
if [ -b "${luks_target}" ]
864866
then

0 commit comments

Comments
 (0)