10

Everywhere I read that internally SSDs are structured in 4K or larger "pages", which grouped in "blocks" of about 128-256 pages (1, 2). SSDs work with these pages and blocks, "they can only erase data at the block level" (thus the block of pages is called "[NAND] erase block"). And the 512B blocks for the partition are emulated (which is done for legacy reasons).

I'm trying to get educated on SSDs, since I have some weird lags/freezes during writes to my Sandisk U100 on Samsung 9 np900x3c laptop. And one useful thing would be to correctly find out what pages/blocks my SSD has?

Is there a utility or /sys/... file on Linux to determine the SSD page size?

Or "the drive and Googling the part numbers on the NAND chips may be needed", as in the comment?

Googling my Sandisk SSD I cannot find a proper datasheet/spec. But Sandisk and people do mention "4K random reads/writes". Does it mean the disk has 4K pages?

Also, fdisk shows me sector size (both physical and logical) and I/O 512 byte:

Disk /dev/sda: 128.0 GB, 128035676160 bytes
255 heads, 63 sectors/track, 15566 cylinders, total 250069680 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x4b914713

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048    50331647    25164800   83  Linux
/dev/sda2        50331648   239583231    94625792   83  Linux
/dev/sda4       239583232   250068991     5242880   82  Linux swap / Solaris

What is "physical" sector size here? It doesn't seem to be the parameter of the SSD drive itself, since everybody say SSD pages are 4K+. Is it the emulated parameter for the disk? And "logical" is the sector size for the partition? Also, what is I/O size?

PS

This question is probably the same as this one for USB flash -- the answer is missing the point there, man fsstat says fsstat displays the details associated with a file system and the question is about the disk itself. My post has more details, maybe it would attract better responses?

9
  • The physical block size reported by fdisk is the physical block size reported by the disk when asked. It seldom has any relationship with SSD pages or erase blocks.

  • 4 KiB reads/writes are a common measure of I/O performance, representing "small" I/O operations.

  • There is no standard way for a SSD to report its page size or erase block size. Few if any manufacturers report them in the datasheets. (Because they may change during the lifetime of a SKU, for example because of changing suppliers.) There is a whitepaper from Intel which suggests that 4 KiB alignment is enough.

  • For practical use just align all your data structures (partitions, payload of LUKS containers, LVM logical volumes) to 1 or 2 MiB boundaries. It's an SSD after all--it is designed to cope with usual filesystems, such as NTFS (which uses 4 KiB allocation units). If Windows considers that aligning partitions to 1 MiB is enough you can bet that any SSD manufacturer will make sure that their products work well with such a configuration.

  • Best leave about 5% to 10% of unallocated space outside any partitions. Having overprovisioned space is of great help to SSDs in maintaining their performance in time.

  • "There is a whitepaper from Intel which suggests that 4 KiB alignment is enough." How do you get that from the linked paper? I looked over it, and it isn't at all obvious where the paper is claiming that. – Matthew May 31 at 20:14
  • @Matthew: Page 7: "most new HDDs and Intel SSDs perform better with a 4096 Byte (4KB) alignment". – AlexP May 31 at 20:34
  • I read that as "compared to 512 bytes", which is hardly surprising. Additionally, the following figures seem to imply a 4KiB page size. I don't read that as implying that "4KiB is good enough for drives with pages > 4KiB"... or that it's meant to say anything about non-Intel drives. – Matthew Jun 3 at 15:17
2

smartctl (available in smartmontools) should do it for you.

  • 1
    How would the OP use this tool to do so? – roaima Jan 4 '17 at 14:25
  • for now I'm getting the same 512B physical & logical sectors with smartctl -i /dev/sda, not sure how to read smartctl --all /dev/sda and smartctl --xall /dev/sda sent kernel into panic.. – xealits Jan 4 '17 at 16:36
  • 2
    Having read up on SMART, I think it doesn't address such information as SSDs internal structure -- it monitors some parameters on errors/"health" of a disk, trying to catch possibility of disk failure – xealits Jan 5 '17 at 13:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.