Create swap partition on Ubuntu

To create a swap partition after an Ubuntu installation create an empty partition that should have no holes. You can then format this partition with

sudo mkswap /dev/sdx

replacing sdx with your partition. Mount this partition as swap with

sudo swapon -U UUID

where UUID is that of your /dev/sdx as read from this

blkid /dev/sdx

Bind your new swap in /etc/fstab by adding this line:

UUID=xxx none swap sw 0 0

If you want to use your swap for hibernating then you need to update the UUID in /etc/initramfs-tools/conf.d/resume with this content RESUME=UUID=xxx. Don’t forget to $ sudo update-initramfs -u.

This entry was posted in Linux and tagged , , , . Bookmark the permalink.

1 Response to Create swap partition on Ubuntu

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.