TT#165600 Add support for NVMe disks

The logic to detect disks via /proc/partitions didn't cover NVMe disks,
as the regex '[a-z]$' fails for the "nvme0n1" pattern:

| % cat /proc/partitions
| major minor  #blocks  name
|
|  259        0  500107608 nvme0n1
|  259        1     524288 nvme0n1p1
|  259        2  499582279 nvme0n1p2
|  [...]
|    8        0  384638976 sda
|    8        1  384606208 sda1

Instead, let's use lsblk to detect present disks, which works
fine for all kinds of disks, incl. NVMe devices.

Change-Id: I586877da8b4fadf3d05b4e6c8e88bfdeae6d7f15
mr10.4
Michael Prokop 3 years ago
parent a99d9ff6e2
commit f27f51c6c8

@ -71,7 +71,8 @@ get_disk_info() {
rm -f /tmp/disk_options
declare -a AVAILABLE_DISKS
AVAILABLE_DISKS=( $(awk '/[a-z]$/ {print $4}' /proc/partitions | grep -v '^name$' | sort -u) )
AVAILABLE_DISKS=( $(lsblk --list -o NAME,TYPE | awk '$2 == "disk" {print $1}' | sort -u) )
if [[ -z "${AVAILABLE_DISKS[*]}" ]] ; then
dialog --title "Disk selection" \
--msgbox "Sorry, no disks found. Please make sure to have a hard disk attached to your system/VM." 0 0

Loading…
Cancel
Save