It’s doable with a swap file instead. But some filesystems are more supportive than others.
For example BTRFS doesn’t support swapfiles over multiple devices (so my raid1c3 spanning 3 differently sized disks for example) and also swapfiles must be completely pre-allocated.
And no matter the filesystem you need to manually tell the kernel device and physical offset for the file via kernel parameters. Which can again be easier on some than on others (also causing the no-multiple-device filesystem problem mentioned above.
People still use swap partitions instead of swap files?
This. Swap files on LUKS encrypted partition. Also, the swapspace daemon!
I’ve seen so many setups where people encrypt their data but forget to encrypt their swap.
Don’t you need swap partitions to be able to use hibernation?
It’s doable with a swap file instead. But some filesystems are more supportive than others.
For example BTRFS doesn’t support swapfiles over multiple devices (so my raid1c3 spanning 3 differently sized disks for example) and also swapfiles must be completely pre-allocated.
And no matter the filesystem you need to manually tell the kernel device and physical offset for the file via kernel parameters. Which can again be easier on some than on others (also causing the no-multiple-device filesystem problem mentioned above.
Nope, I hibernate with a swap file and it’s in a LUKS partition. Although IIRC that whole setup requires me to use systemd boot.
I don’t use hibernation so I’m not sure.