[TriLUG] SWAP and SSD vs HDD

Don Jerman djerman at pobox.com
Thu Nov 6 15:01:04 EST 2014


Ah basic information - I've just been reading on this:

Most SSD are built on flash memory cells, which yes, have a limited number
of writes depending on the details of their construction.  There are 2 or 3
methods in use which get faster at the expense of durability - single-level
cells give around 100000 writes, mostly used in usb keys and the like.
Multilevel cells get about 10000 and triple level cells only about 2000, or
so it's said (they're new-ish).

Virtually all flash storage devices have a firmware layer that maps
physical cells into blocks to seem like regular block storage devices, and
it applies a wear-leveling scheme to prevent all the writes going to the
same set of cells even if you write the same logical block over and over
(like touching a lock file and updating its metadata). Most will also move
"long-static" blocks around to wear out those cells too (so that archived
video file doesn't lock away all the "fresh" cells).  The same firmware
applies error correction and silently detects failed cells to be mapped out
of the drive's available space (unless there's an ioctl to inquire about
that, then it's not entirely silent).  Most devices are over-provisioned
(amounts vary) so the first failed blocks aren't visible in terms of
capacity reduction, and the device can do some signalling when cells start
to fail.  And since they're wear-leveled, by the time the overage starts
getting used up all the cells will be near failure.  This also means they
tend to fail all-at-once, so don't put anything there that isn't backed up
somewhere else.

So for a 160GB drive with TLC (worst-case) you'd expect to write 320TB
(maybe more) to it before you break down, but you're not getting your hands
on one of those - yours will probably be multi-level which should be good
for about 1.6 petabytes of writing.  Even at SSD speed that should take a
long time - probably long enough for you to be upgrading your system a
couple of times for other reasons.

In a server situation you should probably mirror all SSDs and stagger the
mirror with shelf spares to reduce the chance of simultaneous failure (that
is, replace the odd members of all pairs after about 1/4 of expected
service life, so that the fresh one you swap in will carry the mirror when
the older one fails - you can use the 1/4 used ones as replacements when
that happens).

Turning back to the topic, swap reads are typically low priority, and SSD
writes are typically not as much faster than HD writes as to make a
difference in a situation where you're utilizing all your RAM.  SSD reads
are fast but typically swapping involves low-priority dirty blocks so you
won't notice that much unless you've got bigger problems with working set
management - probably better addressed by fixing programs than fixing
hardware.

So I haven't run a linux laptop in a few years - is is possible to specify
a hibernation file path separately from swap?  That would be cool with an
SSD - just use it for OS files and sleeping.


On Thu, Nov 6, 2014 at 9:23 AM, Tim Jowers <timjowers at gmail.com> wrote:

> Is it true the lifespan of SSD is determined by number of writes?  If so,
> then I'd guess file storage will put very, very little demand on it. If you
> figure 1 write per day then 2000 writes comes out to 5+ years. Am i
> thinking correctly?
>
> Thanks for the education,
> Tim
>
>
> On Thu, Nov 6, 2014 at 8:57 AM, Igor Partola <igor at igorpartola.com> wrote:
>
> > All of the recent drives have a volatile cache of 16-64 MB. This is both
> > not enough for an 8GB swap partition and in this case will be used by the
> > drive for its primary purpose: file storage.
> >
> > Yes, if you are concerned about drive wear, just put it on the HDD. If
> you
> > run out of RAM, you will have much bigger things to worry about than
> > exactly how slow swap is :).
> >
> > Igor
> > --
> > This message was sent to: timjowers <timjowers at gmail.com>
> > To unsubscribe, send a blank message to trilug-leave at trilug.org from
> that
> > address.
> > TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
> > Unsubscribe or edit options on the web  :
> > http://www.trilug.org/mailman/options/trilug/timjowers%40gmail.com
> > Welcome to TriLUG: http://trilug.org/welcome
> >
> --
> This message was sent to: djerman at pobox.com <djerman at pobox.com>
> To unsubscribe, send a blank message to trilug-leave at trilug.org from that
> address.
> TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
> Unsubscribe or edit options on the web  :
> http://www.trilug.org/mailman/options/trilug/djerman%40pobox.com
> Welcome to TriLUG: http://trilug.org/welcome
>


More information about the TriLUG mailing list