4

I have a Intel Optane P4801X. It is a NVMe storage device.

In Linux, the physical sector size reported is 512 bytes:

$ sgdisk -p /dev/nvme0n1
Disk /dev/nvme0n1: 195371568 sectors, 93.2 GiB
Model: INTEL SSDPEL1K100GA
Sector size (logical/physical): 512/512 bytes

In Windows, the physical sector size reported is 4096 bytes:

PS c:\> get-disk | select model,LogicalSectorSize,PhysicalSectorSize

model                LogicalSectorSize PhysicalSectorSize
-----                ----------------- ------------------
INTEL SSDPEL1K100GA                512               4096

I am confusing, which one is correct?

I do notice an output from smartctl -x:

Supported LBA Sizes (NSID 0x1)
Id Fmt  Data  Metadt  Rel_Perf
 0 +     512       0         2
 1 -     512       8         2
 2 -     512      16         2
 3 -    4096       0         0
 4 -    4096       8         0
 5 -    4096      64         0
 6 -    4096     128         0
Chau Chee Yang
  • 991
  • 2
  • 13
  • 21
  • 1
    Does this answer your question? [What's the point of hard drives reporting their physical sector size?](https://superuser.com/questions/982680/whats-the-point-of-hard-drives-reporting-their-physical-sector-size) – harrymc Dec 18 '21 at 11:15
  • @harrymc: part of the question that doesn't answer is why the same drive would report different sizes in different OSes. Also, this is tagged Optane: most of the linked Q&A doesn't apply: the underlying storage's write granularity is 64-byte or narrower [since it's 3D XPoint not NAND flash](https://www.anandtech.com/show/11209/intel-optane-ssd-dc-p4800x-review-a-deep-dive-into-3d-xpoint-enterprise-performance/5). It's not persistent-memory (optane dc pm) so presumably its ECC block size is a lot larger than 8 bytes, possibly > 512B? – Peter Cordes Dec 18 '21 at 11:46
  • Perhaps Windows wrongly assumed 4k write blocks for an NVMe drive? Unless the controller tracks things in whole 4k blocks? I guess it's possible the firmware would internally read and rewrite a larger block, perhaps even using a larger ECC granularity. – Peter Cordes Dec 18 '21 at 11:48
  • 512n, 512e and 4Kn drives existed long time and both Windows and Linux has already supported 4Kn drive years ago. I think this shouldn't be some bugs in OS implementation. – Chau Chee Yang Dec 18 '21 at 13:33

2 Answers2

1

The Intel article How to Change the Logical Sector Size in NVMe Drives says very little:

Generic Intel® NVMe SSDs support only traditional 512B and 4096B sector sizes.

A method of finding out (and changing) the LBA Format is shown in the article How to change Intel Optane P4800X sector size. I assume that this disk is a close cousin to your model.

The article says:

The LBA Format for this drive is sub-optimal out of the factory. If you run:

nvme id-ns -H /dev/nvme1n1

It will show you:

LBA Format  0 : Metadata Size: 0   bytes - Data Size: 512 bytes - Relative Performance: 0x2 Good (in use)
LBA Format  1 : Metadata Size: 8   bytes - Data Size: 512 bytes - Relative Performance: 0x2 Good 
LBA Format  2 : Metadata Size: 16  bytes - Data Size: 512 bytes - Relative Performance: 0x2 Good 
LBA Format  3 : Metadata Size: 0   bytes - Data Size: 4096 bytes - Relative Performance: 0 Best 
LBA Format  4 : Metadata Size: 8   bytes - Data Size: 4096 bytes - Relative Performance: 0 Best 
LBA Format  5 : Metadata Size: 64  bytes - Data Size: 4096 bytes - Relative Performance: 0 Best 
LBA Format  6 : Metadata Size: 128 bytes - Data Size: 4096 bytes - Relative Performance: 0 Best

The above first three formats are less efficient. Note that changing the format will most likely require re-formatting the disk.

The article deals with the Linux version of the tools. It's possible that they will work in WSL (although perhaps better in WSL1 than WSL2), but the Windows version could perhaps be found in Intel Solid State Drive Tools.

Running the nvme tool, you might be able to find out the LBA Format advertised by the disk, and change it, if it's not one of the formats listed as "best".

As this is an SSD, I would assume that the real physical sector size is 4K, but that also both 512 and 4096 will work. However, if the operating system is unaware of the real physical sector size, it will work less efficiently with the disk.

harrymc
  • 455,459
  • 31
  • 526
  • 924
  • Do you have idea why both Linux and Windows report different physical sector size for the same Optane device? – Chau Chee Yang Dec 19 '21 at 03:15
  • I would guess that your disk uses the default LBA Format 0, so it advertises itself as 512 bytes. Meaning that the Linux utility you use is entirely right about it. However, the Windows utility looks deeper and reports in addition the real physical sector size. Both utilities are right, but if the Linux disk driver also allocates disk units of 512 bytes, then performance will be affected a bit (probably can't happen). – harrymc Dec 19 '21 at 09:53
0

Your drive most probably is 512e format, like most drives produced today :

512e is the advanced format in which the physical sector size is 4,096 bytes, but the logical sector size emulates 512 bytes sector size. The purpose of 512e is for the new devices to be used with OSs that do not support 4Kn sectors yet. However, inherently, 512-byte emulation involves a read-modify-write process in the device firmware for every write operation that is not 4KB aligned.

source

It looks like Windows is able to detect this and will report the true physical sector size, and won't give you other options than what it deems the best for your drive, while linux "trusts" the drives firmware. Or maybe linux wants to give you the option to use your drive in 512b mode and assumes you have enough expertise to evaluate the cosequences.

1NN
  • 5,232
  • 1
  • 17
  • 37
  • I am aware of 512e drive. I have a number of 4TB HDD that report this `Sector size (logical/physical): 512/4096 bytes`. This is 512e drive. – Chau Chee Yang Dec 18 '21 at 13:28