> ## Documentation Index
> Fetch the complete documentation index at: https://docs.jethings.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Extend RAM

> Add swap to extend RAM before installing PostgreSQL

## Extend RAM

Swap extends RAM and helps prevent OOM crashes. Add a swap file before installing PostgreSQL:

```bash theme={null}
# Check for existing swap
sudo swapon --show

# Create a 2 GB swap file
sudo fallocate -l 2G /swapfile

# Secure and enable it
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
```

Make it permanent by appending the line to `/etc/fstab`:

```bash theme={null}
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
```

Verify:

```bash theme={null}
sudo swapon --show
free -h
```
