Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • you can increase / decrease it's size much easier than resizing partitions;
  • if you use LUKS for encrypting your root partition, then you either have to encrypt your swap partition to maintain security (swap can contain sensitive information and are that is exploitable) or you can simply use a swapfile on your root partition (which is then encrypted along with everything else on the root partition);
  • If you encrypt your root partition AND your swap partition, then you will need to enter two decrypt passphrases (one for root and one for your swap partition) unless you also mount your LUKS swap partition with a keyfile (in which case you'll need to edit /etc/fstab and /etc/cyrpttab) - for a swapfile you don't have to worry about any of that;

...

Code Block
languagebash
sudo dd if=/dev/zero of=/swapfile bs=1M count=17408
sudo mkswap /swapfile
sudo chmod 600 /swapfile
sudo swapon /swapfile


Info
titleBTRFS
For please see BTRFS swapfile for information on creating a swapfile.

Making swap persistent

Doing the above will simply create and enable our swap file.  After a reboot our swap file won't be enabled. 

...

Let's first enable hibernation.  On Arch-based distros , we're going to use a script which automates setting up hibernation.  Install the hibernator package and run it as root.

Warning

Note: the hibernator script is pulled from the AUR (Arch User Repository) and is a user provided script to help in Arch hibernation setup.

You can see what this script is doing here https://github.com/Chrysostomus/hibernator/blob/master/hibernator

You'll also need an AUR helper (or to checkout the AUR hibernator package repo and install with makepkg etc.).  In the example below we're using yay. You cn install yay with:

Code Block
sudo pacman -S yay



Code Block
yay -S hibernator
sudo hibernator

...

To find the UUID for our partition we can run:

Code Block
languagebash
sudo blkid

which will print out the UUID for each of our paritions.  Make note of the UUID for the your root partition. 

...

If you have a LUKS root parition, the easiest way to find the line we're going to be using in our grub config is to run:

Code Block
languagebash
sudo blkid

This will print out our partitions and their UUID.  An example would be:

...