Closed HaleTom closed 6 years ago
Would this help? https://github.com/Nefelim4ag/systemd-swap
@wmertens Very nice!
Now if only I could suspend/resume...
Suspend/resume requires the computer to have enough swapspace to hold its entire memory. Swapspace (the program) does not guarantee this and thus can't be used if you want suspend/resume to work.
btrfs appears to intentionally not support swapfiles, and so I would recommend just using a swap partition, especially if you want suspend to work. I might accept a patch for loopback mounting as a workaround, but really for most modern systems I'd recommend a static swapfile or partition instead.
It is worth noting that macOS seems to manage swapfiles and suspending just fine…
On Sat, Feb 10, 2018, 7:12 PM Jacob Adams, notifications@github.com wrote:
Suspend/resume requires the computer to have enough swapspace to hold its entire memory. Swapspace (the program) does not guarantee this and thus can't be used if you want suspend/resume to work.
btrfs appears to intentionally not support swapfiles, and so I would recommend just using a swap partition, especially if you want suspend to work. I might accept a patch for loopback mounting as a workaround, but really for most modern systems I'd recommend a static swapfile or partition instead.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Tookmund/Swapspace/issues/11#issuecomment-364677438, or mute the thread https://github.com/notifications/unsubscribe-auth/AADWljtbgnQ6toK81h2NtjumX-5J4JHBks5tTdwpgaJpZM4LDMSP .
Likewise, on file systems supporting swap files on Linux (eg, XFS and ext4), suspend-to-disk works fine there too.
It is the CoW file systems (such as ZFS and btrfs) that don't support swap files, though there are workarounds such as using a loopback device, it still won't give you the suspend functionality. Just use a partition instead if you require the feature as well as one of these file systems.
Oh right, of course - I thought the problem was that swapspace can't provide a minimal swap file size.
On Sat, Feb 10, 2018, 8:30 PM Mike Swanson, notifications@github.com wrote:
Likewise, on file systems supporting swap files on Linux (eg, XFS and ext4), suspend-to-disk works fine there too.
It is the CoW file systems (such as ZFS and btrfs) that don't support swap files, though there are workarounds such as using a loopback device, it still won't give you the suspend functionality. Just use a partition instead if you require the feature as well as one of these file systems.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Tookmund/Swapspace/issues/11#issuecomment-364682832, or mute the thread https://github.com/notifications/unsubscribe-auth/AADWlqGPIYNAml0P2EBzlJHK1idChR_wks5tTe5AgaJpZM4LDMSP .
As swapfiles aren't really supported on CoW filesystems, I'm closing this issue. If anyone knows of a better workaround, feel free to reopen it.
btrfs support now swapfiles with Linux kernel 5.0+ ... you need to create the swap file, disable compression and CoW for this file.
Can be possible to add this flags to the swap file creation with a config parameter ?
Certainly possible, pull requests welcome!
For reference https://wiki.archlinux.org/index.php/Swap#Swap_file_creation says these commands are required to setup a swapfile correctly for btrfs
# truncate -s 0 /swapfile
# chattr +C /swapfile
# btrfs property set /swapfile compression none
(and then fallocate swapfile)
btrfs
can only use swapfiles when loopback mounted.Would you consider supporting this?