Skip to content

Commit

Permalink
Fix datactl for NVMe devices (#1550)
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnittl committed Sep 20, 2021
1 parent 7d18740 commit 1e7cd66
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions buildroot-external/rootfs-overlay/usr/bin/datactl
Expand Up @@ -45,8 +45,13 @@ uuid=a52a4597-fa3a-4851-aefd-2fbe9f849079, type=0FC63DAF-8483-4772-8E79-3D69D847
EOF

# Since we create a new partition table etc. we are guaranteed the target
# partition is partition 1
NEW_DEVICE_PART_SIZE=$(cat "/sys/class/block/$(basename "${NEW_DEVICE_ROOT}")1/size")
# partition is partition 1. If the device name ends with a digit, "p" is
# placed between device name and partition number.
case "${NEW_DEVICE_ROOT}" in
*[0-9]) NEW_DEVICE_PART="${NEW_DEVICE_ROOT}p1";;
*) NEW_DEVICE_PART="${NEW_DEVICE_ROOT}1";;
esac
NEW_DEVICE_PART_SIZE=$(cat "/sys/class/block/$(basename "${NEW_DEVICE_PART}")/size")
OLD_DEVICE_PART_SIZE=$(cat "/sys/class/block/$(basename "${DATA_DEVICE_CHILD}")/size")

if [ "${NEW_DEVICE_PART_SIZE}" -lt "${OLD_DEVICE_PART_SIZE}" ]; then
Expand Down

0 comments on commit 1e7cd66

Please sign in to comment.