I can't imagine why a swap file needs to be fixed size. Why not let it resize dynamically, like the hard drive image file for a virtual box?
Ubuntu – Does Ubuntu support dynamic swap file sizing
17.04swap
17.04swap
I can't imagine why a swap file needs to be fixed size. Why not let it resize dynamically, like the hard drive image file for a virtual box?
Best Answer
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:I'd think the same problem would apply to a dynamically-sized swap file.