Resize swap in Ubuntu 18.04 and later (Linux)

Resize swap in Ubuntu 18.04 and later (Linux)

PROBLEM: My swap is too small 🙁
SOLUTION: Disable, resize and enable swap again!

1. Disable swap


2. Resize swap

With goal of 2 GB (1 GB * 2)

Where:
if – input file
of – output file
bs – block size
count – block multiplier

Note: If you get error:
dd: memory exhausted by input buffer of size 1073741824 bytes (1.0 GiB)
just try to change the bs to MB and increase the count size


3. Make the file swap again!


4. Activate swap


(5.) Check the swap file size using top or grep

Subscribe
Notify of
guest
2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Jake
Jake
2 years ago

Hey, it is not restart persistent, how to make it?