fiz: Ignore sector size for whole disk passthrough (#1121)

This commit is contained in:
Quang-Linh LE
2026-01-13 10:40:35 +00:00
committed by GitHub
parent e0545b37d7
commit 0b5d21357e

View File

@@ -573,6 +573,12 @@ addDevice () {
[ ! -b "$DISK_DEV" ] && error "Device $DISK_DEV cannot be found! Please add it to the 'devices' section of your compose file." && exit 55
local sectors=""
local dev_type=""
dev_type=$(lsblk -no TYPE "$DISK_DEV" 2>/dev/null | head -n1)
# Only detect and apply sector sizes for partitions, not whole disks
# Whole disk passthrough with explicit sector sizes causes DSM not to recognize the disk
if [[ "$dev_type" == "part" ]]; then
local result logical physical
result=$(fdisk -l "$DISK_DEV" | grep -m 1 -o "(logical/physical): .*" | cut -c 21-)
logical="${result%% *}"
@@ -586,6 +592,7 @@ addDevice () {
else
warn "Failed to determine the sector size for $DISK_DEV"
fi
fi
DISK_OPTS+=$(createDevice "$DISK_DEV" "$DISK_TYPE" "$DISK_INDEX" "$DISK_ADDRESS" "raw" "$DISK_IO" "$DISK_CACHE" "" "$sectors")