Is it necessary to Swap with SSD?

Hello everyone, sorry but I did not understand the right section for my question, possibly I kindly ask you to move to the right section.
My Manjaro system is installed in dual boot with Windows on a 128 GB SSD and 8 GB of Ram with a 4 GB swap. I have read a few times that on SSDs there is no Swap as they can break the SSD. It’s true? Do I have to remove it or can I leave it, are there other solutions instead of the Swap? Thanks.

It’s not.

It’s a good start!

Hi @eduardolp3,

You might find this helpful:

Specifically the section Swap size.

So there is no problem with having a swap partition on an SSD drive, the drive does not break. Thanks.

All depends on your usage. Use the swap 2 hours each day and goodbye your ssd. 5 minutes each week, ok
usage with an ssd must be exceptional

I have swap with SSD and it works fine. Moreover, I moved to dynamic swap and it made my system stable, because 8GB RAM was too little and now I can have small swap but it can grow as much as needed and there are situations that indeed it saved me. SSD just makes swap more effective. However, the point is, that swap should be an emergency. If you need to use it intensly, then you need to upgrade your RAM.

1 Like

I don’t know how many times I use the Swap, how can I understand? Is there a form of replacing swap space with files, I think I read on the net once, you know something? Anyway, your advice is to eliminate the 4 GB of Swap I have?

This should tell you how much swap is in use when running the command:

/usr/bin/top | head -n 5 | tail -n 1

My advice would be that you keep it, even if you find you don’t use it, like mine. Just because, then it’s there.

And c’mon, man. 4GB is not that much anyway. But for more info, read and apply the info in the Wiki:

In the end, only you can decide. That’s because it’s your computer, your life and you have to use it. And what works for you, might not work for me.

Actually I think I don’t use a lot of RAM, I use the computer for internet, email, streaming etc, nothing too demanding.

/usr/bin/top | head -n 5 | tail -n 1                            
MiB Swap:   4096,0 total,   4096,0 free,      0,0 used.   5747,0 avail Mem 

Thank you.

How do you setup dynamic swap ? I used systemd-swap, but it is not really maintained anymore.

For the OP : you always need swap (I have a swap with 1.5To SSD & 16Go DDR4-3200 MHz RAM )

I installed swapspace from AUR and followed the guide to set it up (configure parameters, enable it). Of course, I got rid of the system default snap partition first.

It was a few years ago and had no issues with it afterwards. It works as intended.

1 Like

I didn’t get how swapspace does the job ?
seems to be different from the use of swapFC by systemd-swap.

I also try to find swapFC setup tutos, but cannot find anything !

Without swapspace, my default swap was 500MB. After installing and configuring swapspace, I start with 2GB swap. When needed, the swap increases, as long I have enough space on root partition. I’ve seen my swap to inctease to 6-10 GB (when compiling a program).

Earlier, when I encounter the situation where I was out of RAM, system swap was used, but it was very slow, causing freezes. At some point, when swap was also out of space, the CPU spiked to 100% on all cores, which freezed entire system.

After installing and configuring swapspace, such things simply doesn’t happen, as the swap is generated and system works, without freezes.

As to installation, I did it many years ago. I rember, I needed to enable the process (so standard systemd commands: sudo systemctl enable xxxxx_proces), but before that, I simply opened an config file and configured it as I wanted.



Then commands:

$ sudo systemctl start swapspace
$ sudo systemctl enable swapspace
$ sudo systemctl status swapspace

It is said that when the new swap is created, you may experience a short freeze. In my case, since all is running on M2 SSD, I don’t see such freezes. If they occur, they are barely noticable.

Of course, I also set my swappiness and zramswap.

Check your swap:

$ cat /sys/fs/cgroup/memory/memory.swappiness


$ cat /proc/sys/vm/swappiness

If you want to edit your swap, edit the file:



eventually, set other parameters like:

vm.dirty_ratio = 10
vm.dirty_background_ratio = 5
vm.dirty_expire_centisecs = 2000
vm.dirty_writeback_centisecs = 1000
vm.swappiness = 10
vm.vfs_cache_pressure = 70

I believe, you will find more details on Arch wiki on that topic.

1 Like

Are you spamming? What has to do the emulator with the matter in question?

cfinnberg just report next time, it is obvious spam, new user, immediate post, text copied from internet not written by him, and of course the off topic sentence with website spam. Obvious spam. I flagged it.

On topic, the wear on the SSD could be possible if your computer is using SWAP all the time a lot, not sure why papajoke wrote

because that doesn’t mean anything here. You don’t quantify the SWAP use by time. You may quantify the SWAP usage by the amount of data written daily for SWAP though. So if you fill your RAM (which is very easy with web browsing when opening multiple tabs, when you don’t have a lot of RAM) and you are constantly using SWAP to free RAM, then on the long run it could, theoretically, prematurely wear your SSD (but it also depends on the SSD, they are not all built equal). But wearing a SSD by having SWAP on it is something that needs to be documented I never heard anything like that.

Your normal web browsing and other activities are probably using/wearing your SSD more than your SWAP in reality. Example, download an ISO, a couple episodes/movies, do some web browsing, download system/game updates, and you already probably written more data to the SSD than the SWAP would have (but again it depends on your SWAP usage).

SSD are built to have a LOT of data written and read everyday, nowadays SSD is a robust technology and you shouldn’t worry about destroying your SSD using SWAP on it (but if you are afraid just monitor things, see if you are swapping a lot and if so then adjust your computer usage, don’t open multiple tabs on your browser, close unused applications, and so on…).

//EDIT: what I would recommend though, is to not have a SWAP partition but using a SWAP file instead, or better in my opinion using systemd-swap and/or Zswap. See the SWAP documentation on the WIKI linked above. You can monitor your SWAP usage in a tool like htop. You can also reduce SWAP usage by configuring some settings (see WIKI again).


With swap,

  • we can have inactive processes (linux preference): no danger : only one write (50Mo…500Mo ?)
  • we can have sometime active processes : big danger : more than 1 000 000 writes by second is not unrealistic with a big cpu. As soon as a variable changes, there is a write on the ssd (a block)
#!/usr/bin/env bash
for counter in {1..1000000}; do
echo "$counter"  # 1 000 000
# less than one second for run this, i count one.

here, if this process is in swap, the “counter” variable changes 1 million times in our swap (1000000*512 = 0.5Gb/second if ssd speed is ok).
one minute = 30GB of writing :grimacing:
More realistic than my script, if it’s a 30 minutes compilation (we have permanently some variables in heap that change) …

Note: do not take these values for reality, they are here to give a picture of the potential danger of the swap in some cases

Still beating a dead horse… for a week now. :smiley:

By that logic you should only have a hard drive as big as your RAM.

If you read a bit about how swap, memory, cache, cpu registers and processes work, you’ll see that your statement doesn’t make any sense.

My bash code was for the non-coders : only to show that the ram changes very very quickly and in no way that this code could affect the swap
Apparently, you didn’t understand ?

To be a bit realistic, later on, I talked about variables in heap, but no interest to go into details. I had written, sometimes “big danger” : so here, I illustrated the worst and not a “normal” use of the swap with only the inactive blocks.

Your statement doesn’t make any sense.

With a hard drive, it was obvious to hear that we wrote permanently to the swap, why would you want it to be different with an ssd?
Thrashing does not exist, it’s only in my head :wink:
ps: ok the worst case is rare (2Go and run VirtualBox ?), but to say that everything is ok is not a service to return to users. With a hard drive, it was obvious to hear that we wrote permanently to the swap, why would you want it to be different with an ssd? for you is only YES can use

for replace “no more than 5 minutes” (yes, no real sence, only is for me: i will not prematurely wear my ssd in 5 minutes)
Since you seem to know a lot about the subject, it might be better to say that it is dangerous for ssd if we use a large percentage of the swap? (although no more sense)