DEBIX Method to Increase Swap Partition

2024.1.22by debix.io

To add swap partitions to DEBIX, follow these steps:

The following commands need to be run with root privileges.


NOTE: The blue font is the log printout of the commands.

1. Check the size of the swap partition, type the command free -m:

                  total        used        free      shared   buff/cache   available

Mem:         1947        808         368        11          771            1039

Swap:         127         39           88


2. Log in to SSH with root, type the command dd if=/dev/zero of=/swapfile1 bs=1024 count=1048576:

NOTE: Here is an example of creating a 1G (my RAM is 2G) swap file (1024 * 1024MB*1G = 1048576).

1048576+0 records in

1048576+0 records out

1073741824 bytes (1.1 GB, 1.0 GiB) copied, 30.0344 s, 35.8 MB/s



3. Create a Linux swap file, type the command mkswap /swapfile1:

mkswap: /swapfile1: insecure permissions 0644, fix with: chmod 0600 /swapfile1

Setting up swapspace version 1, size = 1024 MiB (1073737728 bytes)

no label, UUID=0845fdc8-a7c2-4e39-9af6-4d6cd00b900c




4.Activate the /swapfile1 swap file immediately, type the command swapon /swapfile1:

swapon: /swapfile1: insecure permissions 0644, 0600 suggested.


5.Edit the /etc/fstab file and add the following code:

/swapfile1 swap swap defaults 0 0


6.Edit the /etc/sysctl.conf file, and add the following code:

vm.swappiness=10


7.Type the command reboot to reboot the system.


8.Check the size of the swap partition, type the command free -m:


                  total         used        free      shared   buff/cache    available

Mem:         1947         704         891          1         351              1163

Swap:        1151           0          1151