Live data from Hacker News

Stop making swap partitions—use swap files instead

gist.github.com

251–256 of 256 posts

Re: Stop making swap partitions—use swap files instead

#251
post #116

Earlier quoted context omitted.

the system will kill whatever it damn well pleases. You can tune it with priorities to ask it to try to not kill that, and once it kills your sshd once, you'll probably configure it to exempt sshd from being OOM killed at all. That doesn't fix the memory pressure or hanging or stalling, but you'll at least be able to log into the box still instead of dragging out a serial cable.

are you using systemd or some other init ?

both. freebsd has init scripts. ubuntu has systemd.

this guide should help make it less likely for sshd or your login shell to get killed: https://ianlpaterson.com/blog/oom-lockout-ssh-survival-harde...

Re: Stop making swap partitions—use swap files instead

#252

Earlier quoted context omitted.

I think you're wrong on every single point you make. > Of what distro? Of any distro. I have done such configs with Ubuntu, Debian, openSUSE, SLE, Fedora, CentOS, RHEL, Alpine, Arch, you name it. > If you mean that the example code shows the swapfile directly under / , well of course you don't have to do it that way. Point missed. If you have a swap file created by the installer then you do not get to specify where t…

> If you have a swap file created by the installer then you do not get to specify Why should we care about what the installer does when it's trivial to change later? You said this is "bad advice, except for very simplistic scenarios" but people not in "very simplistic scenarios" are perfectly capable of running a few shell commands. Aside from which, typical home users are in very simplistic scenarios. The Mint insta…

Again, no, on all points.

And you find my response "uncivil" but I find yours very much so as well. You won't even entertain my use cases, and my own direct personal experience, but your bad advice that would have repeatedly lost me all the data in my home directory on my work PC if I used your methods, for you trumps my 38 years of Unix experience.

No. You are being dogmatic, inconsiderate, not listening, responding with ridiculous strawman arguments ("keep swap in your home directory" as a response to "duplicate swap files waste space" -- that is ridiculous) and mockery.

You are rude, and you are arrogant, and you are wrong.

Re: Stop making swap partitions—use swap files instead

#253
post #107

Earlier quoted context omitted.

Worst thing that's ever happened to me is having processes randomly killed by the OOM killer. Could be unpleasant if you're writing an email or document that suddenly disappears because your app got killed.

The OOM killer usually kills the process that's using the most memory, which is the reason the system is OOM. Sometimes this can be adjusted. When I'm OOM it's almost always because some runaway loop used 50GB and it makes no sense to kill any other process. If it's killing your email editor then your email editor is bloated or you just need more RAM - or swap.

Web browsers are most people's email editor.. and yes those things do use a lot of RAM.

Re: Stop making swap partitions—use swap files instead

#254

Earlier quoted context omitted.

> If you have a swap file created by the installer then you do not get to specify Why should we care about what the installer does when it's trivial to change later? You said this is "bad advice, except for very simplistic scenarios" but people not in "very simplistic scenarios" are perfectly capable of running a few shell commands. Aside from which, typical home users are in very simplistic scenarios. The Mint insta…

Again, no, on all points. And you find my response "uncivil" but I find yours very much so as well. You won't even entertain my use cases, and my own direct personal experience, but your bad advice that would have repeatedly lost me all the data in my home directory on my work PC if I used your methods, for you trumps my 38 years of Unix experience. No. You are being dogmatic, inconsiderate, not listening, responding…

> No. You are being dogmatic, inconsiderate, not listening, responding with ridiculous strawman arguments ("keep swap in your home directory" as a response to "duplicate swap files waste space" -- that is ridiculous) and mockery.

I am not being any more dogmatic or inconsiderate than you. I have listened to you quite carefully, and explained in good faith why I think you are wrong based on my best effort to understand you. But you have still not, as far as I can understand, identified a benefit of putting swap on a carefully chosen partition that cannot be realized by putting swap on a file at a carefully chosen path (since that choice also implicitly puts it on a specific partition).

In particular, you are the one who proposed that using swap files would require duplication, and I explained why I disagree. You claimed vaguely that there would be permission issues; when I expressed confusion, you did not elaborate. You have yet to give any concrete reason why there would be duplicate swap files, therefore the fact that duplication wastes space is moot.

My assumption was that you would be sharing /home between the two installations, because there is really nothing preventing you from doing that, and because making two separate /home partitions wastes much more space (because you don't know ahead of time how much space you'll use with each). Unless perhaps you do some bind-mounting trick that I would consider much trickier than setting up a swapfile at a custom path. (/home is owned by root, so there should not be any permission issue with a swapfile at /home/swapfile . If you disagree then you should explain why instead of being vague and dismissive.)

Nothing I said could reasonably be considered "mockery" in any way, shape or form. You are the one engaging in "mockery", by describing my proposal as "ridiculous" in italics without giving any reason as to why it wouldn't work.

Re: Stop making swap partitions—use swap files instead

#255

Earlier quoted context omitted.

What's the benefit of using the TPM compared to a simple passphrase at boot, in that scenario?

A person wouldn't be able to pull the disk to get at the information

Assuming that the person pulling the disk doesn't have the passphrase, what's the difference?

Re: Stop making swap partitions—use swap files instead

#256
post #34

Earlier quoted context omitted.

I have FDE with keys in the TPM. It's pretty smooth bit required a one time additional step in Fedora. It's also probably not very secure, but my threat model is simple theft.

What's the benefit of using the TPM compared to a simple passphrase at boot, in that scenario?

Sorry for the late answer: the benefit is that I don't have to enter my passphrase at boot.
Post reply on HN