Default swap file size?

I installed Eos on Vbox with 4gb ram and excepted the default swap file.
The swap file is only 512mb.
However, as you can see the swap is maxed out and there is 490mb ram available.

free -m
               total        used        free      shared  buff/cache   available
Mem:            3920        3107         123          90         688         491
Swap:            511         511           0

How can I increase the swap file ?

See this thread, assuming you use ext4 not btrfs Filesystem.

think @Cencar uses BTRFS - on ext4 there should be created a swap of 8GB (–> so in my Vbox, no swapfile but partition)

Assuming you chose btrfs, the following will produce (delete old and create new) a 8GB large swapfile. Adjust the size as needed…

sudo swapoff /swap/swapfile
sudo rm /swap/swapfile
sudo btrfs filesystem mkswapfile --size 8g /swap/swapfile
sudo swapon /swap/swapfile
1 Like

Firstly @Zircon34 thanks for the link, all I did was change the count from 8 to 2 giving 2gb swap. Plenty given VB has only 4mb ram.
Nice tip @colin but I have enough trouble using the ext4. Maybe in the distant future I will have a look at BTRFS.
@2000 thanks for the example but as I said I get myself in enough trouble with standard formats. For me it must be KISS[Keep It Simple Stupid].

1 Like

For me it is KISS [Keep It Simple & Secure]


1 Like

Just as a side question, what difference does it make if I create the swapfile as /swapfile or as /swap/swapfile as long as I customize the entry in /etc/fstab?

@Balder don’t know for sure, I think it depends on the filesystem what’s in use.
btrfs needs to create the subvolume /swap

1 Like

If you create the swapfile as /swapfile it will reside in the subvolume mounted at /. Once you put a swapfile in a partition you can’t take snapshots of it or if you have snapshots you can’t use the swapfile.

Creating a separate subvolume mounted at /swap (or anywhere else) solves this issue. Now your swapfile is in a different subvolume where you can do what you want.


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.