1
0
This repository has been archived on 2025-03-31. You can view files and clone it, but cannot push or open issues or pull requests.
wiki.mbirth.de/know-how/software/linux/_posts/2009-08-24-swapfile.md

932 B

created, layout, layout_old, redirect_to, tags, title, toc, updated
created layout layout_old redirect_to tags title toc updated
2009-08-24 22:13:58 +0200 redirect default https://blog.mbirth.de/archives/2009/08/24/swapfile-instead-of-partition.html
know-how
software
linux
Swapfile instead of partition false 2009-08-24 22:13:58 +0200

If you don't want to create a designated swap partition (e.g. if you plan to downsize it later) and don't want to play around with GPartEd, you can create a swapfile instead.

To create a 512 MiB swapfile, do the following:

dd if=/dev/zero of=/swapfile bs=1024K count=512
mkswap /swapfile
swapon /swapfile

To automatically add the swapfile upon boot, add this line to the /etc/fstab:

/swapfile     swap     swap     defaults     0    0

You can later easily change the size of the swapfile by re-creating a smaller or larger one.

You only have to make sure the file is contiguous or swapon might give an error.