Switch Swap from partition to BTRFS

So sometimes I get bored and mess with stuff just to learn new things … with TW (2020 install on SSD) switching to git and the lack of updates I got a little restless and finally decided to switch my swap from a partition to a BTRFS file … I had already switched my BTRFS cache from V1 to V2 in one step instead of the 2 step process most webpages outline … also

  1. Checked my BIOS … an exercise in futility for me because I was looking for Pcie3 and NO Am3 cpu can do that … so I skipped updating that (was at the latest anyway besides a beta)
  2. Checked my GPU bios and reflashed it anyway because I wasn’t sure if I had flashed it earlier to a “modded” bios or not

Now for the new swap … first I turned off the /dev/sda3 swap partition with

swapoff -a

Then commented it out in fstab … created a new swap subvolume and tested it with

swapon /swap/swapfile

and

dart@windeath:~> cat /proc/swaps
Filename				Type		Size		Used		Priority
/swap/swapfile                          file		8388604		20552		-2

Boot to a rescue disk, delete the swap partition and resize / to reclaim the space

Now here’s the “one-step” part … reboot … if you don’t choose the latest kernel-rescue mode the boot will hang because it’s still looking for the previous /swap partition in the initrd … if you choose “rescue mode” it’s as simple as

dracut -f --regenerate-all and reboot

Done … infamous last words … “worked for me”

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.