Welcome to the Linux Foundation Forum!

[Lab 16.1] Swap files and openSUSE

Posts: 9
edited March 2024 in LFS207 Class Forum

Due to the fact that openSUSE's default filesystem is BTRFS, it doesn't allow creating swap files in the conventional way. The following must be done instead (As seen on the ArchWiki):

  1. opensuse:~ # btrfs subvolume create /swap
  2. Create subvolume '//swap'
  3. opensuse:~ # btrfs filesystem mkswapfile --size 1g --uuid clear /swap/swapfile
  4. create swapfile /swap/swapfile size 1.00GiB (1073741824)
  5. opensuse:~ # swapon /swap
  6. /swap

And then we can see the results:

  1. opensuse:~ # cat /proc/swaps
  2. Filename Type Size Used Priority
  3. ...
  4. /swap/swapfile file 1048572 0 -3
  5. ...

I assume the creation of a dedicated subvolume for the swap file must be to prevent it from being accidentally snapshotted alongside with other parts of the filesystem (i.e. by tools such as zypper and YaST when used with Snapper, such as in the default install).

Comments

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training