9

I have 16GB of RAM and the core system is run on 128GB sddisk. So I don't have space to use 16/32 GB for swap.

Can I create swap on another hard disk? Or it has to be on the same disk as the system?

EDIT

What are the steps to migrate swap from /dev/sdc3 to /dev/sdb. The file fstab looks like this

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda2 during installation
UUID=6d9c9f84-02f0-4f59-b57f-6a4ebd06b87f /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sda1 during installation
UUID=4B73-5222  /boot/efi       vfat    defaults        0       1
# /home was on /dev/sda4 during installation
UUID=b0233bff-100f-4741-ad00-29ffc6f26057 /home           ext4    defaults        0       2
# swap was on /dev/sda3 during installation
UUID=1a3ad087-9ba3-4312-9307-a84dade9e1bf none            swap    sw              0       0
ubuntico
  • 2,872

2 Answers2

8

Yes.

You can choose to do this at the time of installation, or you can make a swap partition with a tool such as gparted and then activate the swap with swapon. Add it to your fstab to make it available on boot.

For help with making the swap partition: How do I restore a swap partition I accidentally deleted?

For help with turning swap on: You literally just type sudo swapon into a terminal

For help with adding to your fstab: How do I add a swap partition after system installation?

Mitch
  • 4,807
5

Since you have 16GB of RAM, there is no need for a 'swap' partition. Also, the 'swap should be 1-2 times the RAM' rule is only valid for systems having less RAM, ie < 2GB.

You can create a swap partition on a separate drive by using mkswap and swapon.

Eg - To to migrate swap from /dev/sdc3 to /dev/sdb1 -

swapoff /dev/sdc3

mkswap /dev/sdb1

swapon /dev/sdb1

and edit swap entry in /etc/fstab.