I want to install Ubuntu on my machine by allocating 400 GB for the /
partition and 50 GB for the /home
folder and 16GB RAM. Does it make sense, in this case, to create a swap partition or is it useless?

- 56,709
- 26
- 150
- 232

- 693
4 Answers
Swap partition doesn't have links to partition size or partition use but linked to memory & some I/O usage...
Swap is needed only to manage on this. It's always a good Idea to have e little swap even when it seems to be useless just in case... it should be needed ... someday....
Even with a 64Gb ram machine I Use some swap if it is an important machine like production server or backup machine for example.

- 1,219
-
It also depend on the type of production servers, their loads and how much RAM you allocated for them. As a rule of thumb, DHCP/DNS servers wont need it much, Java-based application servers or MySQL server might need a larger swap often in a while. – Rui F Ribeiro Jan 13 '18 at 17:26
Swap is just like an extension to your physical RAM, and it caches unused data from your RAM, freeing critical RAM space, and speeding some of your operations up. It doesn't have any direct relation to how much space you allocate for each partition. If you're sure that you have plenty of RAM, then you may simply give a lesser amount of swap. But just in case, using a large and generous swap partition ( >= 1 GB) is all good and fine.
There used to be an old rule: Swap = RAM * 2, but this doesn't apply to modern systems.
For more information about what swap is, refer here. Or better, google it out.

- 288
- 1
- 10
-
1I also agree that nowadays a 1-2G partition should be enough for most common servers. – Rui F Ribeiro Jan 13 '18 at 17:10
As @francois says, it is always a good idea to have a partition, mainly because you might have a contingency situation someday, and it will keep the kernel happy.
Modern kernels are however not that much dependent on having swap as in the past.
However, having a large enough root partition, more than enough RAM, and swap being rarely used, it does not need to be a partition. Create a 51MB/1G swap file inside the root partition if you want a simpler configuration.
You will only need larger swap files in production servers like application servers, databases or large web servers.

- 56,709
- 26
- 150
- 232
Swap needs will depend on how much RAM you have and what your system will be used for. I give my machine with 16gb of RAM 4gb of swap, it very rarely gets used. My linode.com VPS with 1gb of ram has 256mb swap and even acting as mail/web/etc for a private domain it rarely uses swap.
Depending on what the machine will be used for I'd reconsider that space allocation - my /home
takes much more space than the rest of the filesystem, except for one spot that I store ISO and OVA files on (which is actually yet another disk on a different mount point).

- 4,955
zram
(uses RAM only) andzswap
(uses RAM with block device) which use compression algorithms to increase virtual memory size. compression ratio can be very impressive but depends, of course, on what is being compressed. – cas Jan 14 '18 at 03:43