4 ms·
I always felt nervous about resizing a filesystem that has a swap file on it. Never had a kernel panic but would swapoff the file just in case. If I created a
by VLM 4y ago
I always felt nervous about resizing a filesystem that has a swap file on it. Never had a kernel panic but would swapoff the file just in case.
If I created a swap partition in LVM I can force it and move it around to the best location WRT multiple hard drives and possible mix of HDD and SSD. With a file its a little more abstract and I could emulate it with some pointless abstraction, but why bother. A typical "this century" example would be running my boot and swap on local disk and storing all real world data on the NAS over iSCSI. Obviously now that "Everything" is virtualized this kind of system administration is void unless you're admin on the cluster itself LOL.
The problem with swap is memory seems to have gotten cheaper than storage and swap of any form takes storage space. Its not the capex that's the problem, its the opex of now you've got an extra 32GB that "has to" be backed up and "has to" be virus scanned or whatever security theatre, and that swap file "has to" be treated as the highest security PII HIPPA PCI category because who knows whats been swapped out of memory onto it, it could be chock full of CC numbers how do you know for sure unless its empty or not there? Paying for more memory doesn't increase your backup storage / security risk / virus scan times and the latter costs more than the former. I don't think non-cloudy admins realize there are cloudy admins out there with forests of little systems with like 8 GB of ram and 16 GB of storage, so the "old" rules from the 1980s about provision twice your ram as swap would increase the disk required from 16 GB to 32 GB doubling my costs for, essentially, nothing. Another problem with swap is in the old days if you needed more memory than you have physically you had to buy more memory, then for awhile you could emulate memory very slowly with disk but much faster than calling an IBM CE and buying more memory, now if you need more memory you spin up more instances or rebuild the instance on a larger flavor about as fast as how you'd add swap in the olden days, probably faster and it can be done dynamically in some architectures.
- tatref 4y agoDo you also feel nervous when resizing a FS that has files in use? I've never thought about the AV scan of such a file!
- CoolCold 4y agoFor growing FS, with regular files, I'm not feeling nervous. I was at the beginning like 15 years ago, but both XFS/Ext4/BTRFS works fine. As side note, not nervous when resizing NTFS in Windows, even for shrinking (still recommend to have backup for shrinking though).
- xani_ 4y ago> The problem with swap is memory seems to have gotten cheaper than storage and swap of any form takes storage space. Its not the capex that's the problem, its the opex of now you've got an extra 32GB that "has to" be backed up and "has to" be virus scanned or whatever security theatre, and that swap file "has to" be treated as the highest security PII HIPPA PCI category because who knows whats been swapped out of memory onto it, Why on earth you'd backup swap? Also encrypted swap is pretty easy to setup, then again most distros don't give that option on install. We have tiny swap, like 1GB, working basically as "early warning" of "hey, this server probably could use few GBs more of RAM". There is very little use for any more swap than that >I don't think non-cloudy admins realize there are cloudy admins out there with forests of little systems with like 8 GB of ram and 16 GB of storage, so the "old" rules from the 1980s about provision twice your ram as swap would increase the disk required from 16 GB to 32 GB doubling my costs for, essentially, nothing. The "old rules" for swap were never relevant. But dumb myths die hard.
- viraptor 4y ago> The "old rules" for swap were never relevant. They did make sense in some contexts. Specifically for laptops expected to hibernate you need to preserve the whole ram. Then you need the extra size for whatever your swap was already using. For small ram systems, 2x the memory size was a good rule of thumb. It stopped making sense when we stopped using swap and filing memory in normal situations.
- drewg123 4y agoTraditional *nix and BSD systems use swap partitions for crashdumps, so giant swap partitions made sense before those systems supported mini dumps. Admins that grew up with those systems are used to the "2xram" rule of thumb. I just yesterday had to re-partition a FreeBSD kernel test box with 256GB of RAM and a 2GB swap partition because I desperately needed a crashdump and the mini dump would have been 7GB.
- wlonkly 4y ago> Why on earth you'd backup swap? The quotes around "has to", and especially the virus scan, makes me think there's a blanket corporate policy that applies to all files, regardless of file type.