Talk:Swap

From ArchWiki

systemd-swap

Can we add more documentation on what this is? How it works? What's the difference between Swap File Universal and Swap File Chunked? Do we need to activate both zram and zswap? Do we need both swapfu and swapfc? When would we want a certain configuration? Where is the swap file located? Can we use this to enable hibernation?

—This unsigned comment is by An2quo (talk) 16:41, 11 January 2017‎. Please sign your posts with ~~~~!

That information seriously belongs to https://github.com/Nefelim4ag/systemd-swap -- not here, since they are just details for the script. We already describe the background info in Swap, Zswap, Improving_performance#Zram_or_zswap and Power_management/Suspend_and_hibernate#Hibernation, your questions can be answered by simply reading the script. -- Lahwaacz (talk) 16:59, 11 January 2017 (UTC)
I want to cast my vote for a bit more documentation (may be just a few sentences, as it is done for many other articles in the wiki) as to how different the systemd-swap is. I'd agree that most information should be somewhere else, but I'd really appreciate if I can have enough to make a decision about using it. As an example, will hibernate be still supported if I chose to go with systemd-swap? -- Romstor (talk) 04:27, 30 December 2018 (UTC)

swapspace

Before I just go and do it, I wish to know if a section about swapspace (aur) would be useful. It dynamically allocates SWAP as needed.

—This unsigned comment is by Krutonium (talk) 03:13, 1 September 2017‎. Please sign your posts with ~~~~!

There is already systemd-swap, so why not... -- Lahwaacz (talk) 08:23, 1 September 2017 (UTC)

swapfile creation on btrfs

On btrfs the swapfile should be located in its own subvolume regardless of using snapper or not. The benefit of adding swapfile in its own subvolume is that it does not block performing a snapshot of /. There was a note regarding this which was reverted. It is uncertain if the notice should be included in Snapper or in Swap#Swap_file because 1) the method is not limited to be beneficial to snapper user. 2) the configuration of swapfiles for btrfs appears to be in Swap#Swap_file Krismorel (talk) 16:21, 11 February 2020 (UTC)

The btrfs-specific section is Btrfs#Swap file, not Swap#Swap_file. -- Lahwaacz (talk) 16:25, 11 February 2020 (UTC)
and Btrfs#Swap file refers to Swap#Swap_file :-). The exact quote "The proper way to initialize a swap file is described in Swap file#Swap file creation." —This unsigned comment is by Krismorel (talk) 16:31, 11 February 2020‎. Please sign your posts with ~~~~!
So? Everybody reading your note in Btrfs#Swap file can substitute /swapfile for the appropriate path. Also note that Btrfs#Swap file already contains a note about the same problem and that using "@" to refer to a subvolume is highly confusing outside of the Snapper page. -- Lahwaacz (talk) 16:48, 11 February 2020 (UTC)

Clarify swap discovery

The systemd-gpt-auto-generator(8)manual and the Systemd#GPT_partition_automounting explicitly state the automount capability to be exclusively tied to the GPT and the The Discoverable Partitions Specification. Also the wiki page somewhat honors this by "linking" to the systemd section with "see below". Shouldn't the wiki page be revised to clearly differentiate between MBR partition type and GPT partition type by deliberately untangling the introductory paragraph of the "Swap partition" section with its mix of MBR and GPT specific features? Drich (talk) 12:24, 18 February 2021 (UTC)

Does Zswap need be explicitly disabled when using zram-generator (or SwapOnZRAM in general)?

As I understand it, Zswap and Zram both compress memory in RAM, but Zswap is meant to be used in conjunction with a normal swap file/partition, while Zram works best when it's the only swap. I had assumed that, since the section for zram-generator didn't mention Zswap, it would be automatically be disabled, but I don't think that's the case. The page for Zswap says that it's enabled by default, the Zram appears to be treated the same as a swap file/partition (eg. listed in swapon --show), and I couldn't find anything in the source code for the Zswap module, zram-generator, or the swapon tool that would prevent this combination. If swapon does need to be manually disabled when using Zram as a swap, then there really should be a note in this article mentioning it and linking to Toggling zswap.

LRFLEW (talk) 22:23, 7 October 2021 (UTC)

It seems zswap is enabled by default since around 2020. It might be different on other distributions and the authors of the zram-generator might not be aware of the behavior on Arch. — Lahwaacz (talk) 18:06, 12 October 2021 (UTC)

Swap file creation: more specific mount options for btrfs

the Swap#Swap_file_creation section has a note that states "When using Btrfs, do not forget to add the created subvolume to the list as well, and remove the discard,autodefrag and compression options." Could we be more specific about which options should be used? Are we sure we should not just use "defaults" as recommended on the man page btrfs(5) § SWAPFILE SUPPORT?

—This unsigned comment is by Thawn (talk) 23:16, 28 December 2021. Please sign your posts with ~~~~!

There are no options that should be used. The note says which options should not be used, the rest is up to you. E.g. to mount a btrfs subvolume, you typically need the subvol or subvolid option, see Btrfs#Mounting subvolumes. — Lahwaacz (talk) 07:36, 29 December 2021 (UTC)