New installation coming up. 120gb SSD for OS and HOME and 1tb HDD for storage. 16gb of ram which means 16gb of swap if I recall correctly. SSD space is too valuable for a swap partition right? If my thinking is correct can someone guide me through or point me in the right direction for putting a swap partition on a second hard drive? I have always selected the automatic settings when installing ubuntu. Thanks!
A swap partition on your SSD will let you wake up faster from hibernation (aka "suspend to disk") as compared to swap on a hard drive. But given the incredibly fast boot time of Ubuntu when booting from SSD a wake up from hibernation may be slower than a reboot.
If you do not hibernate you may never need to swap at all.
Only in case you often have very many RAM intensive applications running in parallel, your system may eventually use swap. Then a swap on SSD will be somewhat faster than a swap on a hard drive. Still there is no need to worry about wearing of your SSD from extensive swapping.
If not used for hibernation you can alway add a swap partition or swap on file later:
Apart from the other great answers, I just wanted to ask that you can have more than one swap partition. So you could put 4GiB of swap on the SSD and the rest in the HDD so if you need to swap something during your computers usage it goes to the fast swap. If you hibernate, probably the SSD swap won't be enough and you'll need the HDD swap too.
To do this, you'll need to create one swap partition in each disk, and once installed you'll need to open
/etc/fstab so your system gives preference to the fast swap. So open a terminal and execute
sudo gedit /etc/fstab. You'll need to locate the pair of lines referencing your swap partitions, and edit them to add the
pri setting (a higher number on the fastest disk):
# before UUID=some-large-number none swap sw 0 0 UUID=another-large-number none swap sw 0 0 #after UUID=some-large-number none swap sw,pri=10 0 0 UUID=another-large-number none swap sw,pri=20 0 0
You need to know which of this is in the fast disk and which on the slow disk. Executing the
blkid on the terminal will help you identifying each one.
SSDs are faster (although speeds decrease in time here too) but also have a smaller lifespan. Before making this choice think about the swapping habits of your distro.
Correct me if I'm wrong but this setup is your home PC, right? With 16GB I really doubt that you'll be doing much swapping especially since for example hibernation rarely works properly and is disabled in Ubuntu by default.
As an alternative to a swap partition you can use a swap file. The huge advantage with the second is that it can grow and shrink according to your needs where a partition is usually harder to deal with especially if it is between two other partitions and there is no space left.
Read here for more information on SSD for swap space:
For swap size see:
Personally with 16gb of memory to your disposal I wouldn't even bother with a swap partition... Just make sure that you add the following line to the end of the /etc/sysctl.conf file and things should run as normal:
vm.swappiness = 0
...save and reboot and no swap needed... I use this for my 2gb machine and never had a problem or slowdown since...