# Using swap

Swap can be utilised by the system to free up space in RAM. For most use cases it is recommend to create a swapfile that is one and a half times the size of your RAM.

To create a swapfile of 8 GB use:

```
# dd if=/dev/zero of=/swapfile bs=8M count=1024 status=progress
```

To create a different size of swapfile, change the `count=` amount to a desirable size.

Then to actually add the swap space to your system issue these commands:

```
# chmod 600 /swapfile
# mkswap /swapfile
# swapon /swapfile
```

To mount the swap to the system at boot, add the swapfile to your `/etc/fstab`:

```
/swapfile none swap defaults 0 0
```

And do not forget to reconfigure the kernel after updating`/etc/fstab`:

```
# xbps-reconfigure -f linux<version>
```