Ubuntu/swap

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< Ubuntu
Revision as of 18:44, 3 December 2022 by Woozle (talk | contribs) (Created page with "==About== Newer versions of Ubuntu use a regular(ish) file for swap, rather than a partition -- so resizing it is now possible without rebooting or mucking around with {{l/cmd...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

About

Newer versions of Ubuntu use a regular(ish) file for swap, rather than a partition -- so resizing it is now possible without rebooting or mucking around with fdisk.

Commands:

  • swapon --show
    • Confirms the swap-file status (default is currently 2 gigabytes)
  • sudo fallocate -l 4G /swap4G
    • creates a new swapfile-compatible 4 gigabyte file named /swap4G
    • Regardless of what's implied by the tldp.org instructions, you can do this before disabling the old swapfile as long as you give it a different name.
  • sudo mkswap /swap4G
    • Mark the new file as a swapfile.
  • sudo swapon /swap4G
    • Tell the swap system to use the new file.
  • sudo swapoff /swapfile
    • Turn off usage of the given swapfile (/swapfile is the name of the default) -- but make sure you've got enough RAM free first, or have set up another swapfile!
    • Yes, you can have two swapfiles in use simultaneously.

Notes