Unverified Commit 0b5d2135 authored by Quang-Linh LE's avatar Quang-Linh LE Committed by GitHub
Browse files

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

parent e0545b37
Loading
Loading
Loading
Loading
+18 −11
Original line number Diff line number Diff line
@@ -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")