0

I recently installed Ubuntu and in the process of completion i realized that i had not dedicated a swap memory during installation. How can i go about adding the swap memory without reinstalling Ubuntu.

1 Answers1

3

Recent versions of Ubuntu install a swap file rather than a dedicated swap partition. So likely, you do have swap. Check the status of your swap with the command

swapon

If you have a swap file in use, you eventually can change the size.

If you do not have swap, then you can add it after installation. The easiest is to add a swap file. Adding a swap partition requires you to change the drive partitioning. Typically, you reduce an existing partition or delete a partition to create free space, in which you can create a swap partition.

In both cases, you need to "declare" the swap space in the configuration file /etc/fstab for it to be used as swap.

For a swap file, you need to add a line like:

/swapfile none swap sw 0 0

You need to provide the actual name of your swap file if you did not create it as swapfile in the root directory (/).

For a swap partition, you need to identify the UUID of your swap partition and then refer to that partition by UUID as explained here or here.

vanadium
  • 88,010