How to disable swap?

I use Clear Linux on SSD ad would like to disable swap. I tried methods from google, they do not work. Is it possible to do this in Clear Linux?

What’s wrong with your swap ? Do you have any issues ?
In my opinion, it’s always a bad idea trying to manage the memory instead of the kernel

But you might find interesting things here :

When you make a fresh installation of clear Linux, there is no swap partition. The swap is a file.
My file partition is 64 Mio for 7,7 Gio of ram and it is empty. It is not used

If your is a partition, you can delete it and replace it by a file. The file size change with the need of your system.

Everything is fine, except that it reduces the service life of ssd.

I saw this instruction on the link. This is about how to add new drives using fstab. I don’t have fstab at all.

I have the same setup. Swap as a 64mb file. I want to disable its use.

I don’t think 64mb of swap will reduce the life of your SSD

Take a look at the end of the link :
« Clear Linux OS takes advantage of systemd as an init process and the modern mounting and booting mechanisms it provides. This, in turn, allows Clear Linux to operate even when no /etc/fstab file is present »

Maybe yes, maybe not. The question was different: how to disable a swap?

As I said this link I saw and read the whole, even this text. I also read about systemd, but I still did not understand how to disable a swap using it.

If you don’t know why and how, probably keeping it enable is the best way :wink:

1 Like

This is something like: I want to fly into space, but I don’t know how. If you don’t know how, can it be better to stay on earth? If we had reasoned like this, we would never have made progress. :slight_smile:

Is your ssd from like 2003? All that stuff on the interwebs about ssds wearing out is based on old information. When they first came into use they where less reliable with short er lifespan that in-class HD. Now that is no longer true: they last much longer than HD and are more reliable due to not having mechanical parts that could potentially fail. Of course it ultimately depends on the product but in most cases (almost all) you’ll find it to be true. Depending on your controller though, you can extend the life of your ssd even more by leaving an unused partition at the end, say 10%. I’m saying this from study as well as a fair amount of empirical experience. I have a good bit of hard ware in my charge ranging from the Data center class level to consumer and enterprise grade company laptops and desktops all the way down to thin clients.

Yes. But it can be better if you don’t know why …

I do not understand why, instead of answering the question, everyone prefers to chat with me about my SSD, to litter the topic.

If you do not know the answer, do not write anything better.

1 Like

I was responding to this. I thought it might be helpful to others who happen across this to know that this isn’t true, at least or especially not in such a broad and general sense. Using swap does not in general decrease the service life of ssds. Swapping to an sd card may reduce its service life.

Sorry to bother you with my replies, I just share my experience and what I thought
And my thought is : trying to disable 64mb of swap, which is apparently difficult to find and without exactly knowing why, is just a waste of time

1 Like

No worries. My apologies as well. I don’t mean to muddy the waters.

what methods have you tried?

Thing you could maybe look into:

  • recompile the kernel without support for paging of anonymous memory <- this is the method I would recommend

  • run swapoff -a #see swapoff --help

  • run swapoff in a systemd service wanted by

By the way, I have another problem - the printer does not work. If I do not find a solution on the forum, then I will also create a topic. And I’m already afraid that you will come and say - why do you need to print, everyone has been using electronic document management for a long time. You know how many trees it took to make paper and stuff like that. :slight_smile:

I already said why I need it - swap reduces the life of the SDD. It is a fact. Even taking into account the fact that over the years they began to support a larger number of write cycles, they are still very far from hdd.

For me, this is not a waste of time. On other Linux distributions, I did this and there were no problems.

I tried swapoff. It works, the swap disappears, but appears within a minute or two. Given the lack of a fstab in the system, it is impossible to remove it using known methods.

By the way, I also tried to set vm.swapiness = 0, which in principle would also suit me, but the setting is also reset after some time to its original value.

Thank you. But I would like to do without kernel recompilation. This is a bad decision because in this case I will have to do this every time a new version of the OS is released.

I tried swapoff. The swap appears again after some time. This is essentially a useless utility at the moment.

As for the third point - can you tell in more detail what do you mean?