3

I'm about to install Linux in an SSD and I have doubts about how much swap space I should allocate.

I have a 1TB SSD drive and 16GB of RAM. I'm not sure if I even need to allocate space for the swap but i have found different opinions on the internet about it.

1

It's wise to have swap space setup. From years gone by, the recommendation was to have twice the swap as you had RAM. Now about 1:1 works fine. 16GB is ~1.6% of your total disk space, so probably not a huge amount to spare.

EDIT: Oh, nearly forgot, if you are planning to use suspend to RAM (which you should), then I recommend that you have at least as much swap space as you have RAM, in this case 16GB.

| improve this answer | |
  • Yes i heard that too. But i also read some articles that didnt recommend to have a swap space at all in a SSD. Why's that? – facuhump May 28 at 21:57
  • 1
    The underlying technology under which SSDs work implies that there's an aspect of wear of the blocks, significantly more impactful on the first generations than on modern hardware. So it got people nervous about it (also I would wager the cost per GB was higher on your SSD than on your RAM stick, so it was worth having more RAM and saving on swap space). People said the same about using full disk encryption on SSDs..... – Pedro May 28 at 22:03
  • 1
    Today though, I don't think it's an issue at all. Disks are more reliable, wear levels are significantly less impactful than before, wear levelling controllers do an excellent job at ensuring you don't get "hot spots", etc. I have been using SSDs on a daily basis for many years now and have never had a failure. – Pedro May 28 at 22:04
  • 2
    Thank you pedro, so what you say is that with a 4gb of swap it would be ok and i wouldn't probably even use it? – facuhump May 28 at 22:32
  • 1
    If you were to do that, apart from suspend-to-ram (hibernation) you'd be alright for 99% of the time (unless you know you'll be doing really RAM intensive work). But with a 1TB disk, it's better if you do the whole 16G since it may not be as easy to add afterwards if you think you'll need it. – Pedro May 28 at 22:54
0

You should break this down into two steps:

1) Create two or three small partitions, also one 1-2GB for EFI partition, if ever. A partition big enough for hibernation (suspend-to-disk) is also a good idea. A normal size swap would be rather 6GB in your case. It is also possible to activate two (or more) smaller swap devices later.

If you do not use hibernation, then you can use that partition for something else. Same for future swap partitions: if you never use swap, you can format them as data partitions.

2) Try different swap configurations (or: just activate your default one)

Now you can just mkswap one of your small partitions you chipped off the full terabyte, and then swapon.

If you never use EFI, you can use that as emergency swap. If you never use the 6GB as swap, you can put something else there. This takes some configuring, but easier than a partition resize I think.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.