Swap File Setup not working

Hi,

I am running a system, setup with zram and I am trying to create a swapfile setup. I have followed the steps in the arch Arch Wiki.

I created a sub volume:

# btrfs subvolume create /swap

Then I made it a swap file:

# btrfs filesystem mkswapfile --size 4g --uuid clear /swap/swapfile

Then I went to turn on swap and made the changes permanent, editing /etc/fstab.

/etc/fstab
/swap/swapfile none swap defaults 0 0

The system fails to boot… it gets me straight into the emergency mode.

This is my fstab:

# Static information about the filesystems.
# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>
# /dev/sda2
UUID=199abba2-726b-4d43-8f6d-133575927808       /               btrfs           rw,relatime,c>

# /dev/sda2
UUID=199abba2-726b-4d43-8f6d-133575927808       /tmp            btrfs           rw,relatime,c>

# /dev/sda2
UUID=199abba2-726b-4d43-8f6d-133575927808       /var/log        btrfs           rw,relatime,c>

# /dev/sda2
#UUID=199abba2-726b-4d43-8f6d-133575927808       /swap/swapfile  none swap       defaults 0 0

# /dev/sda1
UUID=5D4B-AD6E          /boot           vfat            rw,relatime,fmask=0022,dmask=0022,cod>

# /dev/sda4 LABEL=home
UUID=6647a667-23eb-4781-b94d-1abf33a0e56c       /home   ext4            rw,relatime     0 2

I have commented the swap entry out, for now, so the system boots.

Any help would be appreciated.

Don’t use an UUID in the swap line, just

/swap/swapfile none swap defaults 0 0

You already have mounted /, this is just swapping on what is already available.

3 Likes

:man_facepalming: That’s what the Wiki says to do… but apparently due to the early morning hour and the lack of coffee, I got distracted by the other entries showing the UUID and added it.

This fixed it. Thanks.

Cheers

1 Like

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