You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tested correctly under Ubuntu 18.04.3 amd64 with Intel p660 2TB nvme 512KB SSD. Multiple nvme existed in the same system and the first one was correctly identified and formated by your modified UDF script "/dev/nvme0n1" the second one was correctly unaffected "/dev/nvme1n1". Disk was read/writable both by Ubuntu 18.04.3 and by Windows 10 1907.
Partitions on nvme "/dev/nvme0n1p1" are identified using an aditional 'p' similar to MacOS using 's' and gives correct handling of the script by suggesting you'd better not use partions(haven't tested a partion since its incompatible with MacOS). Also giving a non existing nvme3n1 as device argument gets detected as not valid.
Note about nvme, the device exists as /dev/nvme0 but its writable block device is /dev/nvme0n1 and its first partition is /dev/nvme0n1p1.
PARENT_DEVICE=$(echo "$DEVICE"| sed -r 's/^(([hs]d[a-z])([1-9][0-9]*)?|(disk[0-9]+)(s[1-9][0-9]*)?|(loop[0-9]+))$/\2\4\6/')
327
+
PARENT_DEVICE=$(echo "$DEVICE"| sed -r 's/^(([hs]d[a-z])([1-9][0-9]*)?|(nvme[0-9]+n1)(p[1-9][0-9]*)?|(disk[0-9]+)(s[1-9][0-9]*)?|(loop[0-9]+))$/\2\4\6/')
328
328
else
329
329
# this machine must have BSD sed ('-E' for extended regex)
330
-
PARENT_DEVICE=$(echo "$DEVICE"| sed -E 's/^(([hs]d[a-z])([1-9][0-9]*)?|(disk[0-9]+)(s[1-9][0-9]*)?|(loop[0-9]+))$/\2\4\6/')
330
+
PARENT_DEVICE=$(echo "$DEVICE"| sed -E 's/^(([hs]d[a-z])([1-9][0-9]*)?|(nvme[0-9]+n1)(p[1-9][0-9]*)?|(disk[0-9]+)(s[1-9][0-9]*)?|(loop[0-9]+))$/\2\4\6/')
331
331
fi
332
332
333
333
# validate parent device identifier (must be entire device)
334
-
(echo "$PARENT_DEVICE"| grep -Eq '^([hs]d[a-z]|disk[0-9]+|loop[0-9]+)$') || (echo "[-] <device> is of invalid form (invalid parent device)">&2; false)
334
+
(echo "$PARENT_DEVICE"| grep -Eq '^([hs]d[a-z]|nvme[0-9]+n1|disk[0-9]+|loop[0-9]+)$') || (echo "[-] <device> is of invalid form (invalid parent device)">&2; false)
335
335
336
336
# verify parent is a device, not just a file
337
337
[[ -b /dev/$PARENT_DEVICE ]] || (echo "[-] /dev/$PARENT_DEVICE either doesn't exist or is not block special">&2; false)
0 commit comments