Turning on swap with a page file: Difference between revisions

From Leo's Notes
This page was last edited on 15 June 2020, at 02:03.
Created page with "To enable swap on a system that has no dedicated swap partition (such as a really small VPS or VM), create a swap file: {{highlight|lang=terminal|code= # dd if=/dev/zero of=/..."
 
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:


{{highlight|lang=terminal|code=
{{highlight|lang=terminal|code=
## 1GB swap file
# dd if=/dev/zero of=/swap bs=1M count=1024
# dd if=/dev/zero of=/swap bs=1M count=1024
# chmod 600 /swap
# chmod 600 /swap
Line 11: Line 12:
Naturally, the swap space here incurs the filesystem overhead as well.
Naturally, the swap space here incurs the filesystem overhead as well.


[[Category:Linux]]
{{Navbox Linux}}[[Category:Linux]]

Latest revision as of 02:03, 15 June 2020

To enable swap on a system that has no dedicated swap partition (such as a really small VPS or VM), create a swap file:

## 1GB swap file
# dd if=/dev/zero of=/swap bs=1M count=1024
# chmod 600 /swap
# mkswap /swap
# swapon /swap
# echo "/swap swap swap defaults 0 0" >> /etc/fstab

Naturally, the swap space here incurs the filesystem overhead as well.