0

I've been using this guide as my go-to for how to install Ubuntu onto my desktops, particularly the partition scheme:

http://www.tecmint.com/ubuntu-14-04-installation-guide/

However, I've realised my primary desktop setup has evolved to the point where I might want to modify it on a future reinstall. Specifically, I want to use a RAM disk setup. I've just upgraded to 16GB of RAM (which is way more than most of my tasks will require for ordinary memory) and I believe there are methods of making the disk dynamically resize according to the system's actual memory requirements (or am I thinking about the SWAP file?).

Therefore, is it still a good idea to have the SWAP partition set to twice the total RAM size (so a total of 32GB) as the guide says, if indeed the RAM disk can resize according to memory requirements? I'd rather save some of the SWAP for more HOME partition space. The HDD is 1TB.

I'm also going to ask a similar question about my Gigabyte BRIX 2807 micro desktop setup. I have a maximised 8GB of RAM, and again I'd like to use a fair portion of that for a RAM disk. I also have an SSD, so I'd like to optimise it's write life cycle. I'm going to follow this guide:

http://bernaerts.dyndns.org/linux/74-ubuntu/250-ubuntu-tweaks-ssd

Therefore, considering my prior question, was it also a good idea to set the SWAP to 16GB or twice the RAM size? Should I resize the SWAP partition to account for both the envisioned RAM disk and the optimisation of the SSD's write life cycle? Or not, preventing me from having to reinstall?

The distro on each desktop is Ubuntu 15.04.

1

There is no valid reason any more to have multiple partitions, esp. on personal desktops/laptops. This is even reflected in the default setting for the partition manager: everything on a single partition.

I don't bother with a swap partition. IIRC, the Ubuntu installer won't let you install without one, so pick the smallest size you can get away with, and after you've installed, turn swap off permanently. Esp. if you have an SSD, you don't want gratuitous writes if you can avoid them. I haven't run a machine with swap in at least half a dozen years.

As for the ramdisk, what's the point of having one if you're going to back it up with disk? Just use the disk directly! I also assume you mean 'tmpfs', not a real old-style ramdisk, right?

Hope this helps,

/ji

1

A RAMDISK is a block device that is backed by your RAM. Think of it as a way to use your RAM as a 'hard drive' in the sense you could read/write files to it, however all the limitations of RAM would still apply - notably that it's volatile and rebooting your server would cause all data on that drive to be lost.

A Swap partition on the other hand is a way for your computer to use Hard disk space as a form of "Slow RAM" - when you run out of RAM, your computer can start to use the swap partition to keep things running. Obviously this is bad, as hard drives are significantly slower than RAM is.

I can't really elaborate much more on the rest of your question, as I think you may have confused some of the terminology.

Personally, I keep my /home directory on another disk entirely, and / on an SSD, allowing for system reinstalls without losing most of the data.

0

The suggestions of setting your swap size to be 2x the size of your RAM are based on very old recommendations and don't apply to modern systems.

At a very high level, swap is only used when you run more programs than you have memory to hold them, so the least used memory is written out to swap until it's needed again, at which point it's traded for something else to be written out.

Why would a computer with only 2GB RAM require 4GB swap (effectively 6GB RAM) while a computer with 32GB RAM require 64GB swap (effectively 96GB RAM)? You will easily use up all of the memory on a 2GB RAM machine in day to day use, but would be hard pressed to use 32GB RAM under most situations. 2x your RAM as a general rule just doesn't make sense.

Instead, look at your normal usage, monitor the memory used, and then add a little paddinge for safety. Odds are, with 16GB RAM,The suggestions of setting your swap size to be 2x the size of your RAM are based on very old recommendations and don't apply to modern systems.

At a very high level, swap is only used when you run more programs than you have memory to hold them, so the least used memory is written out to swap until it's needed again, at which point it's traded for something else to be written out.

Why would a computer with only 2GB RAM require 4GB swap while a computer with 32GB RAM require 64GB swap? You will easily use up all of the memory on a 2GB RAM machine in day to day use, but would be hard pressed to use 32GB RAM under most situations. 2x your RAM as a general rule just doesn't make sense.

Instead, look at your normal usage, monitor the memory used, and then add a little padding for safety. Odds are, with 16GB RAM, you'd do fine with no swap file at all.

  • Fair enough. I think then for the micro desktop with an SSD, I'll reserve around 4GB as a RAMDISK and allocate the rest for general memory. Therefore I'll use around 4GB of SWAP space as I believe the memory hasn't exceeded that. Maybe I should add a bit more for hibernation though? – SeUmas Pablo Finlayson Sep 1 '15 at 8:44
  • Don't use RAMdisk for swap. It's not needed and you're just wasting RAM. Set vm.swappiness to 0 and you should be fine. I've used no swap space on recent linux installs - from servers with 4GB of RAM to laptops with 32GB of RAM. They've all been fine. – Jeremiah Peschka Sep 7 '15 at 23:21

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.