17

I recently bought a Samsung 970 EVO Plus 2TB SSD and I would like to know something about wear leveling and partitions.

Does wear leveling work the same regardless of whether I partition it or not? I would like to make three partitions and I'm afraid that this will break this useful algorithm.

I mean, does wear leveling work on each partition separately or on the entire physical disk?

I tend to believe that for the whole disk because otherwise, the overprovisioning partition would not make sense. But I want to be sure.

5
  • “…wear-leveling works on each partition separately or on the entire physical disk…” It’s based on the whole disk itself. Otherwise, if this were an issue, there would be tons of articles explaining how to best partition SSDs. The reality is if that were ever the case, SSDs would not be as popular as they are. Why purchase faster storage that somehow fails in some new, crazy way! Nov 24, 2022 at 19:26
  • 1
    @Giacomo1968 I was thinking about the following scenario... There are 2 partitions: one almost full with data that has not been rewritten for a long time (C:), and the other almost empty, which is always written and deleted (D:). Do you mean that, when D: gets too worn out, the controller will move the data from C: to D:, and when I write to D:, it will actually be written to C: ? Nov 24, 2022 at 19:36
  • 7
    You are overthinking this. As the other answers state, partitions are an OS level construct. The drive itself doesn’t care. So if wear occurs on the SSD, and that area contains data for drive D:, it will just look for work areas on the disk without thinking of partitions. Nov 24, 2022 at 20:14
  • 1
    Partition table is like the table of contents in a book. For you it divides the book into chapters, but the book doesn't care - the whole table of contents is just letters.
    – gronostaj
    Nov 24, 2022 at 21:20
  • 1
    How is this not a duplicate? Nov 26, 2022 at 2:08

4 Answers 4

31

The wear-levelling is performed by the SSD controller, and basically the controller is unaware of partitions and filesystems.

The important point is that there exists a mapping table between the drive logical sectors (the ones that the OS addresses) and the drive physical sectors in the NAND chips. The wear-levelling and garbage collector algorithms heavily rely on this mapping table.

The logical address space of the drive is possibly partitioned, but the physical address space is not.

For instance, the OS tells the controller to write some data to the logical sector #A which is close to the beginning of the drive from the OS point of view, but the controller can decide to use any physical sector anywhere on the drive. For instance the sector #B that is near the end of the drive if it has a low write count, and it updates the mapping table with a link (logical)#A --> (physical)#B. Then when the OS wants to read the logical sector #A, the controller actually returns the content of the physical sector #B.

Whether the logical sector #B is in the same partition than the logical sector #A or not is irrelevant.

Furthermore the controller can decide at any moment to move the content of the physical sector #B to any other physical sector #C, and he just has to update the mapping table #A --> #C. This is completely transparent for the OS.

16

The partition-table is understood principally by the operating system and in a limited way by the BIOS/EFI.

The disk's firmware only knows about blocks and sectors and that's all.

Answer : Partitioning changes nothing for wear-leveling.

8

You are right; it doesn’t make sense.

Consider the most popular desktop OS, Windows. Windows creates three partitions right off the bat: An EFI partition, disk (C: drive) partition, and a recovery partition. If multiple partitions stopped wear leveling, then almost every desktop on the planet would not use it. Wear leveling works at the SSD firmware's level; it doesn’t care what the file system or partitioning is.

5

Yes, wear leveling works across the whole SSD. When you're overprovisioning (either manually by creating an empty unused partition, or using Samsung Magician), you're creating an empty partition that will serve as a pool of empty blocks that can be used by the wear-leveling algorithm. If your SSD is rated at 1000 write cycles, there is a difference between writing 1000 times to a single block, and distributing the writes across 1000 different blocks.

In practice, with normal SSD use, a part of your drive will always be empty, so the main reasoning behind having an unused partition is to prevent excessive wear if you fill up your whole disk with data. In that scenario, the algorithm won't have too many empty blocks to shuffle around, so it will reuse existing blocks.

There is some data from Samsung showing how overprovisioning relates to lifespan, but the methodology behind these tests is unclear:

enter image description here

9
  • 4
    Overprovisioning is mostly useful for the garbage collector mechanism, not that much for the wear-levelling mechanism. But actually all drives have some hidden amount of overprovisionning that is not visible by the OS.
    – PierU
    Nov 25, 2022 at 9:07
  • 1
    Well I agree, but technically garbage collection exists because of wear-levelling :) But not having overprovisioning affects even the writes (before the GC even kicks in), because the controller can no longer just mark the block as stale and write to a new spare block. This is true even if with hidden overprovisioning if you are doing 4k random writes to a full drive, write speed will be heavily degraded because the controller will have to actively clear blocks to create free space.
    – vgru
    Nov 25, 2022 at 12:02
  • 1
    I leave an unallocated portion on a SSD ("for future use") - presumably this is helping out with wear levelling? Nov 26, 2022 at 15:42
  • 1
    @Groo: Flash memory chips are subdivided into blocks holding hundreds or thousands of 528-byte pages. Once a page is written, the only way to reuse the storage is to erase the entire block containing it. If the system decides to reclaim a flash block at a time when it contains 496 pages full of useful data and 16 pages of obsolete data, it will need to copy the 496 useful pages to some other block and erase the old block, and as a result of doing that it will be able to accommodate 16 more page-write operations before the next reclamation operation is required. Adding slack space will...
    – supercat
    Nov 26, 2022 at 18:32
  • 1
    @JeremyBoden: Yes, the more free space you have on the SSD, the longer its lifespan will be. It doesn't have to be a huge partition, you can see from the chart above that even leaving 6.7% unallocated space increases the lifespan 2x.
    – vgru
    Nov 27, 2022 at 19:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .