How to Add swap space

Here is where you can post tips and tricks to share with other users of MX. Do not ask for help in this Forum.
Message
Author
User avatar
CharlesV
Administrator
Posts: 8068
Joined: Sun Jul 07, 2019 5:11 pm

How to Add swap space

#1 Post by CharlesV »

I see people all the time with no swap file or swap space, and many dont understand a) that even a little swap space is VERY good for your system, and b) how to create swap once your up and installed.

The reality of the first part is that some swap space is required for some applications to properly run. Even if you have gobs of ram, the reality that some applications need 'a little swap space' , or will just check for it before they start, or will even allocate a little swap space just in case.

Many times the creation of a small swap space will resolve "odd issues" that are hard to pin down, and creation of a swap file even can help test / resolve some issues.

So, how can you easily check and create swap ? ... This is the best guide I have found and covers checking, turning on and off and creation of both types of swap.

https://www.digitalocean.com/community/ ... -debian-11
*QSI = Quick System Info from menu (Copy for Forum)
*MXPI = MX Package Installer
*Please check the solved checkbox on the post that solved it.
*Linux -This is the way!

User avatar
artytux
Posts: 398
Joined: Wed Apr 26, 2023 3:58 am

Re: How to Add swap space

#2 Post by artytux »

@CharlesV Thanks for the link and article, I get these as pdf's incase I lose my own memory in future days passed.
" Outside the square , inside the cube "

User avatar
CharlesV
Administrator
Posts: 8068
Joined: Sun Jul 07, 2019 5:11 pm

Re: How to Add swap space

#3 Post by CharlesV »

Your very welcome! and yes, I have both links and PDF's of too :-)
*QSI = Quick System Info from menu (Copy for Forum)
*MXPI = MX Package Installer
*Please check the solved checkbox on the post that solved it.
*Linux -This is the way!

putih
Posts: 49
Joined: Mon Feb 19, 2018 6:44 pm

Re: How to Add swap space

#4 Post by putih »

ZRam and Zswap

zram (previously called compcache) can create RAM based compressed block devices. It is a module of the Linux kernel since 3.2.

If physical swap devices exist, they will also be used by the system, but with a lower priority than a Zram device.

Similar results as with Zram can be achieved with Zswap, though Zswap needs a physical swap device (or swap file).

Zswap
Zswap is a lightweight compressed cache for swap pages. It takes pages that are in the process of being swapped out and attempts to compress them into a dynamically allocated RAM-based memory pool. Older pages can be evicted to disk making this a sort of write-behind cache. zswap basically trades CPU cycles for potentially reduced swap I/O.

Alternative

Similar results as with Zswap can be achieved with Zram though eliminates the need for physical swap device.

https://wiki.debian.org/ZRam

putih
Posts: 49
Joined: Mon Feb 19, 2018 6:44 pm

Re: How to Add swap space

#5 Post by putih »

How to Add ZRam and Zswap with antiX memory manager GUI

antiX memory manager is a Control centre script allowing for checking and managing the way the Linux kernel handles memory usage, in particular activating and deactivating memory compression by zram and zswap.


Page : https://gitlab.com/Robin-antiX/antix-memory-manager

How to install :
Click bin > antiX-memory-manager > click download button
Add extension .sh example antiX-memory-manager.sh
Make shell script executable

Code: Select all

chmod 755 antiX-memory-manager.sh
Run from terminal

Code: Select all

sudo ./antiX-memory-manager.sh
Support

For help, questions, suggestions and bug reporting please write to antiXlinux forums.

Contributing

If you find a translation of user interface or user manual being inadequat or misleading wrong, please edit it simply on antix-development at transifex. On transifex you may edit the string translations used in user interface directly.
If you happen to have knowledge and want to help improving this tool, please bark up in antiX forum (see Support link above).

Authors and acknowledgment

This is an antiX community project. In particular many thanks to anticapitalX and anti-apXos !

Image
Before

Image
After
Last edited by putih on Sat Jul 19, 2025 10:28 am, edited 2 times in total.

User avatar
Eadwine Rose
Administrator
Posts: 15259
Joined: Wed Jul 12, 2006 2:10 am

Re: How to Add swap space

#6 Post by Eadwine Rose »

Please don't post screenshots of code output, they cannot be searched. You can post code on the forum like this:

[code]code output here[/code]

Thanks.
MX-23.6_x64 July 31 2023 * 6.1.0-39amd64 ext4 Xfce 4.20.0 * 8-core AMD Ryzen 7 2700
Asus TUF B450-Plus Gaming UEFI * Asus GTX 1050 Ti Nvidia 535.247.01 * 2x16Gb DDR4 2666 Kingston HyperX Predator
Samsung 870EVO * Samsung S24D330 & P2250 * HP Envy 5030

User avatar
dings
Posts: 183
Joined: Wed Mar 16, 2022 5:26 am

Re: How to Add swap space

#7 Post by dings »

Thank you for posting this, @CharlesV

User avatar
CharlesV
Administrator
Posts: 8068
Joined: Sun Jul 07, 2019 5:11 pm

Re: How to Add swap space

#8 Post by CharlesV »

dings wrote: Sat Jul 19, 2025 3:29 pm Thank you for posting this, @CharlesV
Your very welcome.
*QSI = Quick System Info from menu (Copy for Forum)
*MXPI = MX Package Installer
*Please check the solved checkbox on the post that solved it.
*Linux -This is the way!

AA BB
Posts: 393
Joined: Mon Nov 11, 2019 10:49 pm

Re: How to Add swap space

#9 Post by AA BB »

If MX is installed without specifying a swap partition , will it automatically use root partition file /swap ?
In which case we only have to ensure the root partition has enough free space (say 2x RAM size).

I always specify a root partition but for the most part it goes unused on systems with >4G RAM

User avatar
j2mcgreg
Global Moderator
Posts: 7212
Joined: Tue Oct 23, 2007 12:04 pm

Re: How to Add swap space

#10 Post by j2mcgreg »

AA BB wrote: Sun Aug 10, 2025 12:00 pm If MX is installed without specifying a swap partition , will it automatically use root partition file /swap ?
In which case we only have to ensure the root partition has enough free space (say 2x RAM size).

I always specify a root partition but for the most part it goes unused on systems with >4G RAM
If you use the 'automatic install using entire disk' option, a swap file will be created by default. If you use any of the custom install options, it is up to you to create a swap partition. or. follow these instructions to create a swap file post install:
https://www.digitalocean.com/community/ ... -debian-11
HP 15; ryzen 3 5300U APU; 500 Gb SSD; 8GB ram
HP 17; ryzen 3 3200; 500 GB SSD; 12 GB ram
Idea Center 3; 12 gen i5; 256 GB ssd;

In Linux, newer isn't always better. The best solution is the one that works.

Post Reply

Return to “Tips & Tricks by users (not for help)”