Manjaro Difference between revisions of "Talk:Swap"

Difference between revisions of "Talk:Swap"

Discussion page of Swap
(→‎Swapfile on BTRFS: - additions for disabling compression and subvolume not nested under root)
(→‎Swapfile on BTRFS: - practical experience details to add)
 
Line 19: Line 19:
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 /
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.  
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. Addition: When booted externally from Manjaro installation boot media, I could move a subvolume from /run/media/{user}/{mnt-dir}/timeshift.../@/@bsvtest upwards to /run/media/{user}/{mnt-dir}/@bsvtest using root permissions. Yet since the original filesystem root, parent to /@, becomes inaccessible when /@ is mounted to "/", the @swapfile subvolume must be mounted to a directory via /etc/fstab - I named it /@swapfile - see below. The option compress=no is ignored (perhaps because /@ is already mounted with compress=zstd), so chattr +C +m is mandatory.


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  
Before I found the way to move it, I had deleted the swapfile subvolume in .../timeshift.../@/@swapfile (first learned the ID via $ sudo btrfs subvolume list / - then had it deleted by $ sudo btrfs subvolume delete -i {nnn} /) and created the subvolume again as child of parent volume ID 5 - booted 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
- There 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
'$ sudo btrfs subvolume create /run/media/{user}/{mnt-dir}/@swapfile

Latest revision as of 16:31, 7 December 2024

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. Addition: When booted externally from Manjaro installation boot media, I could move a subvolume from /run/media/{user}/{mnt-dir}/timeshift.../@/@bsvtest upwards to /run/media/{user}/{mnt-dir}/@bsvtest using root permissions. Yet since the original filesystem root, parent to /@, becomes inaccessible when /@ is mounted to "/", the @swapfile subvolume must be mounted to a directory via /etc/fstab - I named it /@swapfile - see below. The option compress=no is ignored (perhaps because /@ is already mounted with compress=zstd), so chattr +C +m is mandatory.

Before I found the way to move it, I had deleted the swapfile subvolume in .../timeshift.../@/@swapfile (first learned the ID via $ sudo btrfs subvolume list / - then had it deleted by $ sudo btrfs subvolume delete -i {nnn} /) and created the subvolume again as child of parent volume ID 5 - booted from the Manjaro installation media, then mounted my root filesystem in the file manager (XFCE - thunar), where it listed the subvolumes @ @home @cache @log - There 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.

Cookies help us deliver our services. By using our services, you agree to our use of cookies.