I just finished installing Debian 12 onto a USB flash drive, then distro-morphing it to Kicksecure on my primary development laptop. The laptop has 32 GB RAM, while the flash drive is about 128 GB. I noticed swap-file-creator report it was creating a swapfile that was around 45 GB in size. I can see how this probably happened (I’m guessing it’s making a file equal to RAM size plus 50%), but two things come to mind:
- Creating a 45GB swap file is almost certainly overkill.
- Creating a swapfile that takes up over 35% of available disk space is almost certainly overkill.
By default, Debian chose to give me a swap partition that was only 1 GB in size, which seems much more reasonable for systems that have lots of RAM like mine. Then again, for someone with very little RAM, 1 GB of swap probably doesn’t make much sense and creating a swapfile equal to 1.5x RAM size would be helpful.
Should we change the algorithm used for determining swap file size? Perhaps 1.5x RAM is fine in general, but we should cap the maximum size to 8 GB or so. Taking into account the size of the storage device would probably also be a good idea.