1

If you have already made a swap file during setup of ubuntu, would the commands mkswap and swapon add to it or it replaces it? Is there a way to add to it rather than replace it? Is there a way to do it while you are not sudoer?

2 Answers2

4

You can

  • create a partition and make it a swap partition with mkswap or gparted

  • add a corresponding line in the file /etc/fstab to make it active at boot. You can use

    sudo swapon -a
    

    to make all swap devices (files and partitions in /etc/fstab) active.

  • You can also create a second swapfile (with another name), or maybe better, replace the current swapfile with a new one.

But first you should consider, if you really need more swap and in that case why and how much.


Managing swap is a typical task, where you need sudo permissions.

sudodus
  • 47,684
1

The command swapon <specialfile> adds a swap area prepared with mkswap <device>.

swapon --show displays the active swap areas.

muclux
  • 5,324