User Tools

Site Tools


swapfile

This is an old revision of the document!


i dont bother with swap as ive ALMOST never needed it. if you find yourself in a situation where you do need swap just spin up a swapfile.

create a file with the size of swap space you want. Let’s say that I want to add 1 GB of swap space to my system. Use the fallocate command to create a file of size 1 GB.

fallocate -l 1G /swapfile

It is recommended to allow only root to read and write to the swap file.

chmod 600 /swapfile

mkswap /swapfile

You need to tell Linux that this file will be used as swap space. You can do that with mkswap

mkswap /swapfile

Setting up swapspace version 1, size = 1024 MiB (1073737728 bytes)
no label, UUID=7e1faacb-ea93-4c49-a53d-fb40f3ce016a
swapon /swapfile
swapfile.1714511192.txt.gz · Last modified: 2024/07/23 16:19 (external edit)