---
# System prepended metadata

title: Increase swapfile size
tags: [linux]

---

# Increase swapfile size

###### tags: `linux`


Increase swapfile size.
```
$  free -m
              total        used        free      shared  buff/cache   available
Mem:          15908       12210        2002         902        1694        2577
Swap:          2047        2011          36


$ swapoff -a

$ dd if=/dev/zero of=/swapfile bs=1G count=8

$ mkswap /swapfile

$ swapon /swapfile

$ grep SwapTotal /proc/meminfo
SwapTotal:       8191996 kB

$ free -m
              total        used        free      shared  buff/cache   available
Mem:          15908       13786         168        1358        1953         438
Swap:          7999          96        7903
```

!!! Make sure system has enough free memory first in order to turn off swap.