How to add Swap memory on Ubuntu

Create a file and preallocate size. In the following example we allocate 4GB

$ sudo fallocate -l 4G /swapfile

The prompt will return:

$ ls -lh /swapfile
-rw-r--r-- 1 root root 4.0G Feb 8 08:50 /swapfile

Enable SWAP file




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Mastering the Spotify API -> part1

Apache Camel — Calling a REST API

Python Identifiers: Python Complete Course — Part 8

A dummy image for better reading and navigation.

10 Reasons to Choose Open Source Software for Your Next Project

Cerberus Testing — The All-in-one Test Automation Platform

Ten Reasons Why (we made a procedurally generated sociogenetic simulation in JavaScript)

Custom Docker image as a lambda function.

#freestockphoto (Wednesday 18th 08PM)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Bogdan Alexandru Militaru

Bogdan Alexandru Militaru

More from Medium

Remote backend for tfcdk

Tunnel to Home — Cloudflare Tunnels

CONFIG_IPVLAN for docker on Gentoo