To swap or not to swap;
NMGLugers, I have been helping with a new install on a laptop with an SSD replacing the dynamic hard drive. I am wondering what the best practice is on the swap space. 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? Thank you, Ted P.
Hi Ted, You really want to use swap still, even in 2019. Whether you use a dedicated partition, or just a swap file. Have at least something. Chrome and Firefox can take more RAM up than expected these days. When I was looking into why I should keep swap I came across the Ubuntu FAQ, and that convinced me: https://help.ubuntu.com/community/SwapFaq How much RAM does that system have? How much storage space is the SSD going to provide? Are you going to ever use hibernation? The kernel can handle running out of ram, but if you are bottlenecking the RAM, the kernel is going to pull more resources from disk (swap on or off). IMO, this makes SWAP some what of a mute point. The kernel knows that swap is not recommended, so it will minimize use already. For the ultra paranoid, you can configure swap to be even more restrictive. I could see removing swap if you are extremely limited in space. But you can buy cheap QLC/TLC SSDs drives that are ~$100 for 1 TB. Even cheaper, come Black Friday. So I don't really see space being an issue. If you are really paranoid about keeping the SSD healthy, I would probably buy a new MLC drive or a lightly used SLC drive. Read Samsung Pro * or Intel 750*. And make sure something is triggering TRIM every once in a while (1 month or less) which is common place to have already on by default these days. For the average Joe, I usually tell them to not worry about what you do with the SSD. Unless you know you push out multiple gigabytes daily, you will likely never hit the expected write limit to the drive. You can check the lifespan of most modern SSDs by looking at the SMART data. So you should have some form of a guess oh how healthy the drive is. Also, from prior research, you want to keep the drive powered on, vs having it act as cold storage. SSD rely on having a set voltage in cells. If the drive is powered off for an "extended" amount of time. (Think from months to years) The drive can potentially lose sectors due to low voltage. ~ Jared On 2019-11-04 07:51, Ted Pomeroy wrote:
NMGLugers, I have been helping with a new install on a laptop with an SSD replacing the dynamic hard drive. I am wondering what the best practice is on the swap space.
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? Thank you, Ted P. _______________________________________________ nmglug mailing list nmglug@lists.nmglug.org http://lists.nmglug.org/listinfo.cgi/nmglug-nmglug.or
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
NMGLugers, Thank you Akkana and Jared. I see that I was not up on all the factors. I have re-engaged the swap and you are correct, it is rarely used as there is plenty of ram. The particular laptop has seen lots of use and may have issues or problems not related to the SSD, which is performing well. I will keep testing and exploring and narrow down the actual issues. But glad to rule out this issue and thanks for correcting my knowledge base on the SSD. Thank you, Ted P. On Mon, Nov 4, 2019 at 9:33 AM Akkana Peck <akkana@shallowsky.com> wrote:
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 _______________________________________________ nmglug mailing list nmglug@lists.nmglug.org http://lists.nmglug.org/listinfo.cgi/nmglug-nmglug.org
participants (3)
-
ABQLUG -
Akkana Peck -
Ted Pomeroy