My opinion is quite the opposite. Back in the spinning disk days, I often ran systems without swap because the performance penalty was so high that I was often willing to risk the system crashing.
Since SSDs are so much faster, it makes sense again.
Whether you use swap or not is a matter of personal preference and depends what your workload looks like. Just consider what happens when you run out of memory. Unless you running some kind of OOM manager, stuff just starts failing all over the place and/or your system crashes.
Since most modern SSDs have sophisticated wear leveling the risks to having a swap partition are likely fairly minimal.
If you really want to avoid swapping to your SSD, I would implement zram. This moves your swap into a compressed area in RAM.
and what is about other folders on the SSD? like .cache? I think there are many more writes on .cache than into swap, I could be wrong… but if you have a big amount of RAM swap will not be used that often, but on stuff like browsing with a browser there will be a lot read and writes on cache and tmp.
Unless you’re doing a LOT of swapping and have a really old generation SSD or a cheap QLC based SSD, it’s really not that much of a deal IMO. Modern TLC drives often have about a write per day guarnateed life. Most basic uses will come NOWHERE near this, so a few extra GB won’t mean much.
I don’t know, the lowest most TLC drives go is .2 dwpd. On a 512GB, that means 100GB written EACH DAY, EVERY DAY, for 5 years is the guaranteed life (assuming you’re not buying the ULTRA cheap stuff that only has 3 year warranty). Put another way, that’s 35.6 TB of information written per year for 5 years on a MERE 512GB SSD. I don’t know about you, but I do not approach 100GB written on 99.99999999% of days. Even if I had swap enabled and set to be fairly swappy, I don’t think I’d approach 100GB written every day. And that’s the LOW end of TLC drives, so only goes up from there!!!
I sometimes have difficulty understanding the concept of amount of data written. My SSD hit 1% use when I had written about 800GB data. I was doing android dev and saving device snapshots, building apk on my ssd. That made lots of writes.
so 1% = 0.8TB
then 100% = 80TB; meaning I can write upto 80TB data in total.
Is this reasoning correct?
mine is 256GB ssd.
also how do you find out the dwpd for your ssd?
sudo smartctl -A /dev/nvme0
[sudo] password for lain:
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.10.19-1-lts] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF SMART DATA SECTION ===
SMART/Health Information (NVMe Log 0x02)
Critical Warning: 0x00
Temperature: 30 Celsius
Available Spare: 100%
Available Spare Threshold: 50%
Percentage Used: 1% <------- This ------
Data Units Read: 2,534,295 [1.29 TB]
Data Units Written: 2,106,499 [1.07 TB]
Host Read Commands: 36,021,486
Host Write Commands: 73,751,258
Controller Busy Time: 1,525
Power Cycles: 403
Power On Hours: 445
Unsafe Shutdowns: 296
Media and Data Integrity Errors: 0
Error Information Log Entries: 0
Warning Comp. Temperature Time: 0
Critical Comp. Temperature Time: 0
Temperature Sensor 1: 30 Celsius
I guess we (or at least me) is getting confused again.
“Data units written” only measures the total data written during the life of SSD. My ssd has high value because while doing android dev in Jan, I used to save multiple snapshots a day, each snapshot about 3gb, and did builds also. I wrote a lot of data.
So dividing it by number of days used, gives the average data “you” (the user) wrote to it. Its not what it has been rated at. Do I make sense?
OH…you meant how do you find out the RATED DWPD!! I thought you were asking how do you find your dwpd that you’ve been actually using. MOST manufacturers publish this information on the drives technical page. A few of the lower end 3rd party don’t, but generally all the 1st party and first tier 3rd party distributors do.
I’m at about 36GB daily writes. At this rate, my 1TB SSD would last me 48 years.
I am using swap on my SSD from day one, even if the machine has 32GB RAM installed.
I’d say SSD wear is somewhat overemphasized. Just check your usage numbers an judge for yourself.
I swap. Mainly because I use a laptop and use hibernate. I have 40gb of RAM but only a 20GB swap. I figured in all reality I rarely use more than 20gb at any time so I’ll still be able to hibernate. If I’m working on something requiring more ram than that, I’m probably way to busy to stop, so I still wouldn’t need more.
Point I was really making, if you plan to hibernate, swap is necessary.
Will it be a problem later? I guess I’ll find out. I’ve not had an SSD fail on me except for a kingston drive that came DOA.