Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions cvmassistants/disktool/encryptedDisk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ detect_or_create_partition() {
local suffix

# Try both possible partition naming schemes (e.g., /dev/sda1 or /dev/nvme0n1p1)
part_disk=""
for suffix in "1" "p1"; do
if [[ -e "${disk_dev}${suffix}" ]]; then
part_disk="${disk_dev}${suffix}"
mappername="${mappername}${suffix}"
mappername="${DISK}${suffix}"
log_info "Partition $part_disk already exists for device $disk_dev"
return 0
fi
Expand Down Expand Up @@ -65,8 +64,8 @@ detect_or_create_partition() {
# Try both possible partition naming schemes
for suffix in "1" "p1"; do
part_disk="${disk_dev}${suffix}"
if [[ -e "$part_disk" ]]; then
mappername="${mappername}${suffix}"
if [[ -e "$part_disk" ]]; then
mappername="${DISK}${suffix}"
log_info "Partition $part_disk successfully created on $disk_dev"
return 0
fi
Expand Down Expand Up @@ -130,8 +129,7 @@ fi

diskpath="/dev/$DISK" # /dev/vda
part_disk=""

mappername="${disk}"
mappername=""
detect_or_create_partition "$diskpath" # assign part_disk and mappername
device_to_mount="/dev/mapper/$mappername"
[ -e "$device_to_mount" ] && log_fatal "Mapper $device_to_mount already exists"
Expand Down