[nmglug] To swap or not to swap;

Akkana Peck akkana at shallowsky.com
Mon Nov 4 08:33:21 PST 2019


Ted Pomeroy writes:
> I have heard that the SSD has a limited, if large, number of re-writes in
> its lifetime. Like a usb thumbdrive it can wear out. So, if a computer is
> heavily used would it make sense to add 'noswap' to the Grub default file?
> This would eliminate the many re-writes to swap and preserve the SSD for a
> longer life. Is this reasonable?

Do you actually use swap very often? For the last five years I've
regularly used a netbook with 2G RAM, and I saw it obviously
swapping maybe a dozen times during those years; usually when I
did something silly like load a bunch of big images into GIMP
without closing most of my firefox tabs first. The computer would
slow to a crawl.

I always saw swapping as an emergency measure: "You messed up and
loaded something way too big, so the computer will now let you,
SLOWLY, save your work and quit gracefully instead of crashing."
I certainly wouldn't want to work on a swapping computer on a regular
basis. Either learn different habits (fewer firefox tabs, quit
firefox before starting LibreOffice, only load 3 camera images into
GIMP at a time instead of 10, whatever it takes), or get more RAM.

Given that, having a swap partition available and swapping enabled
doesn't hurt anything: most of the time it doesn't get used but it's
a nice emergency backup if you mess up.

A more relevant question is /tmp, which does get regularly used.
Lots of people recommend putting /tmp on a tmpfs instead of on the
disk. On a spinning disk, that speeds things up marginally and
avoids seeks; on an SSD, it reduces the writes to the SSD. I haven't
actually converted my /tmp to tmpfs and I don't think it makes a
huge difference either way, but there are reasaonable arguments for
doing so.

        ...Akkana


More information about the nmglug mailing list