Szerző: Simon Hobson Dátum: Címzett: dng@lists.dyne.org Tárgy: Re: [DNG] noatime by default
Alessandro Selli <alessandroselli@???> wrote:
>> I figure that over sizing the
>> drive will help with wear leveling. I'm not sure if that is a valid
>> assumption, however.
>
> I am convinced it is. The more cells to pseudo-randomically spread writes
> to, the lower the number of write operations that are performed on each one
> of them.
Provided that the drive knows the block is "unused" - which requires that the OS support TRIM. Without TRIM, when a block changes from in-use to free, the drive will still see it as "a block with data in it" - and thus it cannot erase it and put it in it's free pool. I'm not sure that writing zeroes to it will make it "free" to the drive.
However, I'm not sure it makes much difference unless large contiguous blocks are free. Because the SSD works with larger block sizes internally, if any one part of that larger block is in use, then the whole block cannot be free.
As well as wear levelling, having more free space also improves write performance. SSDs are blazingly fast at writes, until ... they run out of pre-erased blocks. When this point is reached, write performance drops through the floor.
When you write a block of data to an SSD, it must first read the rest of the storage block (I vaguely recall this can be in the order of 16k bytes), insert the modified block (512 bytes or 1k ?) into it, and then write it back to disk. because it can only set bits, not unset them, it will have to write this modified storage block to a new location in the array - which means having a spare block available. The previously used block is then put in a queue to be erased (slow operation) in the background.
So if doing a lot of writes, it's possible to use up the erased block pool - then writes will be delayed while waiting for erases to complete.
Partitioning the drive, leaving some space unused is probably the only reliable way to ensure that the extra space is genuinely free - and thus part of the erased blocks pool.
The more of the drive contains static data, then the less space used for wear levelling - unless the drive automatically moves static data around to compensate. I suspect that most drives will these days - which probably makes the whole discussion moot !
PS - once you got to SSD, make sure your backups are kept well up to date. I know this is good advice all the time, but while spinning rust very often gives warning signs before failing, SSD often "just die" with no warning.