Does Ubuntu support dynamic swap file sizing?
It doesn't look like Linux supports dynamic swap file sizing (at any rate, I couldn't get it to detect that a swap file had changed size without a swapoff
/swapon
).
Presumably it is easier to assume that a swap file doesn't change file size dynamically when writing code for supporting it. I don't see any great use for it either. Since you can use multiple swap files, nothing's preventing you from creating more swap files as needed.
Also note this paragraph from the swapon
manpage:
The swap file implementation in the kernel expects to be able to write
to the file directly, without the assistance of the filesystem. This
is a problem on preallocated files (e.g. fallocate(1)) on filesystems
like XFS or ext4, and on copy-on-write filesystems like btrfs.
I'd think the same problem would apply to a dynamically-sized swap file.
SwapSpace is a utility that will allow you to make dynamically sized swap if that is what you are looking for. I do believe it is available in Ubuntu.