** Description changed:
- nvme-cli 2.8-1build2 (in Ubuntu/Noble) shows wrong drive sizes. Compare
- the following two.
+ [ Impact ]
+ * libnvme reports incorrect lba_count, causing nvme-cli to show wrong drive
sizes
+
+ [ Test Plan ]
+ * Running `nvme list` on a system with a 4k sector drive will report
different
+ drive sizes:
+
+ halves@rotom:~$ nvme list
+ Node Generic SN Model
Namespace Usage Format
F
+ --------------------- --------------------- --------------------
---------------------------------------- ---------- --------------------------
---------------- -
+ /dev/nvme0n1 /dev/ng0n1 S4CBNA0N701386 SAMSUNG
MZPLL1T6HAJQ-00005 0x1 1.60 TB / 12.80 TB 4 KiB
+ 0 B G
+ /dev/nvme1n1 /dev/ng1n1 S4CBNA0N701397 SAMSUNG
MZPLL1T6HAJQ-00005 0x1 1.60 TB / 1.60 TB 512 B
+ 0 B G
+
+ On the test above, there are two NVMe drives present of the exact same
+ model. One of them is formatted with 4k sectors, so the total drive size is
+ reported incorrectly. After the patch, both drives have the same (correct)
total
+ size:
+
+ halves@rotom:~$ nvme list
+ Node Generic SN Model
Namespace Usage Format
FW Rev
+ --------------------- --------------------- --------------------
---------------------------------------- ---------- --------------------------
---------------- --------
+ /dev/nvme0n1 /dev/ng0n1 S4CBNA0N701386 SAMSUNG
MZPLL1T6HAJQ-00005 0x1 1.60 TB / 1.60 TB 4 KiB
+ 0 B GPJA2B3Q
+ /dev/nvme1n1 /dev/ng1n1 S4CBNA0N701397 SAMSUNG
MZPLL1T6HAJQ-00005 0x1 1.60 TB / 1.60 TB 512 B
+ 0 B GPJA2B3Q
+
+ [ Where problems could occur ]
+ * lba_count will be recalculated using proper SECTOR_SHIFT information, so
this
+ could "change" apparent drive sizes
+ * partitions and namespace information could be changed or be incorrect due
to
+ the now correct LBA size calculation
+
+ [ Other info ]
+ * this is caused by libnvme not calculating lba_count using proper
SECTOR_SHIFT
+ on 4k drives
+ * kernel reports NVMe sizes in 512 bytes, so this issue doesn't happen on
+ drives formatted using regular 512b sector size
+
+
+ --
+ [ Original Description ]
+ nvme-cli 2.8-1build2 (in Ubuntu/Noble) shows wrong drive sizes. Compare the
following two.
1.16.3 (Ubuntu/Jammy) output:
# nvme list
- Node SN Model
Namespace Usage Format FW Rev
+ Node SN Model
Namespace Usage Format FW Rev
--------------------- --------------------
---------------------------------------- --------- --------------------------
---------------- --------
- /dev/nvme0n1 82xxxxxxxxxx Kxxxxxxx1T92
1 0.00 B / 1.92 TB 4 KiB + 0 B 0106
- /dev/nvme1n1 23xxxxxxxxxx Micron_7xxx_Mxxxxxx960TFR
1 3.60 GB / 960.20 GB 4 KiB + 0 B E2MU200
-
+ /dev/nvme0n1 82xxxxxxxxxx Kxxxxxxx1T92
1 0.00 B / 1.92 TB 4 KiB + 0 B 0106
+ /dev/nvme1n1 23xxxxxxxxxx Micron_7xxx_Mxxxxxx960TFR
1 3.60 GB / 960.20 GB 4 KiB + 0 B E2MU200
2.8.2 (Ubuntu/Noble) output:
- # nvme list
+ # nvme list
Node Generic SN Model
Namespace Usage Format
FW Rev··
--------------------- --------------------- --------------------
---------------------------------------- ---------- --------------------------
---------------- --------
/dev/nvme0n1 /dev/ng0n1 82xxxxxxxxxx Kxxxxxxx1T92
0x1 0.00 B / 15.36 TB 4 KiB + 0
B 0106
/dev/nvme1n1 /dev/ng1n1 23xxxxxxxxxx
Micron_7xxx_Mxxxxxx960TFR 0x1 3.54 GB / 7.68 TB
4 KiB + 0 B E2MU200
-
- The difference is this: 1.92 TB vs 15.36 TB, and 960.20 GB vs 7.68 TB.
+ The difference is this: 1.92 TB vs 15.36 TB, and 960.20 GB vs 7.68
+ TB.
The drives did not suddenly get bigger, but the problem is described here:
https://github.com/linux-nvme/nvme-cli/issues/2260
And fixed here:
https://github.com/linux-nvme/libnvme/pull/803/commits/00efe8364b0a
This fix is included in:
https://github.com/linux-nvme/libnvme/releases/tag/v1.9
That is not available in the 2.8 version:
- # nvme --version
- nvme version 2.8 (git 2.8)
- libnvme version 1.8 (git 1.8)
+ # nvme --version
+ nvme version 2.8 (git 2.8)
+ libnvme version 1.8 (git 1.8)
But it should be in the Oracular 2.10 one:
- nvme-cli (2.10-1) sid; urgency=medium
- [...]
- * Bumping libnvme build-depends to 1.10.
+ nvme-cli (2.10-1) sid; urgency=medium
+ [...]
+ * Bumping libnvme build-depends to 1.10.
Suggested patch fixes things, as can be seen here:
- # nvme list -o json | grep -vE 'ModelNumber|SerialNumber' >old
- (switch to 0osso0 patched build)
- # nvme list -o json | grep -vE 'ModelNumber|SerialNumber' >new
+ # nvme list -o json | grep -vE 'ModelNumber|SerialNumber' >old
+ (switch to 0osso0 patched build)
+ # nvme list -o json | grep -vE 'ModelNumber|SerialNumber' >new
- # apt-cache policy libnvme1t64
- libnvme1t64:
- Installed: 1.8-3build1+0osso0
- Candidate: 1.8-3build1+0osso0
- Version table:
- *** 1.8-3build1+0osso0 500
- 500 http://ppa.osso.nl/ubuntu noble/osso amd64 Packages
- 100 /var/lib/dpkg/status
- 1.8-3build1 500
- 500 http://apt.osso.nl/ubuntu noble/main amd64 Packages
+ # apt-cache policy libnvme1t64
+ libnvme1t64:
+ Installed: 1.8-3build1+0osso0
+ Candidate: 1.8-3build1+0osso0
+ Version table:
+ *** 1.8-3build1+0osso0 500
+ 500 http://ppa.osso.nl/ubuntu noble/osso amd64 Packages
+ 100 /var/lib/dpkg/status
+ 1.8-3build1 500
+ 500 http://apt.osso.nl/ubuntu noble/main amd64 Packages
- # diff -U1000 old new
- --- old 2024-09-06 14:03:36.981330913 +0000
- +++ new 2024-09-06 14:03:10.680072465 +0000
- @@ -1,24 +1,24 @@
- {
- "Devices":[
- {
- "NameSpace":1,
- "DevicePath":"/dev/nvme1n1",
- "GenericPath":"/dev/ng1n1",
- "Firmware":"E2MU200",
- "UsedBytes":3596890112,
- - "MaximumLBA":1875385008,
- - "PhysicalSize":7681576992768,
- + "MaximumLBA":234423126,
- + "PhysicalSize":960197124096,
- "SectorSize":4096
- },
- {
- "NameSpace":1,
- "DevicePath":"/dev/nvme0n1",
- "GenericPath":"/dev/ng0n1",
- "Firmware":"0106",
- "UsedBytes":0,
- - "MaximumLBA":3750748848,
- - "PhysicalSize":15363067281408,
- + "MaximumLBA":468843606,
- + "PhysicalSize":1920383410176,
- "SectorSize":4096
- }
- ]
- }
+ # diff -U1000 old new
+ --- old 2024-09-06 14:03:36.981330913 +0000
+ +++ new 2024-09-06 14:03:10.680072465 +0000
+ @@ -1,24 +1,24 @@
+ {
+ "Devices":[
+ {
+ "NameSpace":1,
+ "DevicePath":"/dev/nvme1n1",
+ "GenericPath":"/dev/ng1n1",
+ "Firmware":"E2MU200",
+ "UsedBytes":3596890112,
+ - "MaximumLBA":1875385008,
+ - "PhysicalSize":7681576992768,
+ + "MaximumLBA":234423126,
+ + "PhysicalSize":960197124096,
+ "SectorSize":4096
+ },
+ {
+ "NameSpace":1,
+ "DevicePath":"/dev/nvme0n1",
+ "GenericPath":"/dev/ng0n1",
+ "Firmware":"0106",
+ "UsedBytes":0,
+ - "MaximumLBA":3750748848,
+ - "PhysicalSize":15363067281408,
+ + "MaximumLBA":468843606,
+ + "PhysicalSize":1920383410176,
+ "SectorSize":4096
+ }
+ ]
+ }
Patch 00efe8364b0.patch is attached.
Summarizing:
ubuntu/jammy - not affected
ubuntu/noble - affected but fixed by 00efe8364b0.patch
ubuntu/oracular - not affected
Cheers,
Walter Doekes
OSSO B.V.
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2079836
Title:
libnvme reports incorrect LBA count on drives with 4k sectors
To manage notifications about this bug go to:
https://bugs.launchpad.net/nvme-utils/+bug/2079836/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs