Talk:Swap

Revision as of 19:52, 2 December 2024 by Ddeberhar (talk | contribs) (→‎Swapfile on BTRFS: - additions for disabling compression and subvolume not nested under root)

This link is not working

https://doc.opensuse.org/documentation/leap/tuning/html/book.sle.tuning/cha.tuning.memory.html The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

If you think this is a server error, please contact the webmaster. Error 404


Swapfile on BTRFS

Disabling Copy-on-write and compression need to be done in one step on the freshly created file:

'$ sudo chattr +C +m /@swapfile/swapfile

If assigning these attributes in two steps, the second will be rejected.


If creating the subvolume as described - $ sudo btrfs subvolume create /@swapfile - it becomes a sub-subvolume of the actually mounted root /@ - this can be shown by: $ sudo btrfs subvolume list -p /

Today I was restoring a snapshot, TimeShift saved my actual system as a snapshot, and included the /@swapfile subvolume, because that was created as a child-subvolume of /@ - I found not quickly a way to move it out of the snapshot.

After I succeeded in deleting the now useless swapfile subvolume (first learned the ID via $ sudo btrfs subvolume list / - then had it deleted by $ sudo btrfs subvolume delete -i {nnn} /) I created the subvolume as child of parent volume ID 5 by booting from the Manjaro installation media, then mounted my root filesystem in the file manager (XFCE - thunar), where it listed the subvolumes @ @home @cache @log Then I created the subvolume in that path shown in the file manager's address line

'$ sudo btrfs subvolume create /run/media/{user}/{mnt-dir}/@swapfile

And I added actually two lines to /etc/fstab - first one copied from the /@ entry with option compression=no

'UUID=nnn-nnn-nnn-nnn-nnn /@swapfile btrfs subvol=/@swapfile,defaults,discard=async,ssd,compress=no 0 0

and a second for /@swapfile/swapfile as described here in the wiki. Then I followed the described creation procedure for /@swapfile/swapfile once more.

Return to "Swap" page.