PDA

View Full Version : [ubuntu] 16.04 Install on SSD: How Much SWAP for 64Gb RAM & Where to Put it? SSD or HDD? How?



OzzyFrank
October 27th, 2016, 04:37 AM
Hi. First off, I've been installing Ubuntu for 10 years now, starting with a dual-boot system in 2006 (with basically no knowledge), and I know how to search for answers (and prefer to do so than ask questions). However, now that I want to install to an SSD drive, with a /home partition on a HDD, I am not sure if I should be using the "Guided" or "Something Else" partitioning options. Also, there is the SWAP question: not just whether I actually need it with 64Gb RAM - and believe me, the opinions on this differ WILDLY! - but whether I should stick it on the SSD (again, much contradictory info on this out there) and HOW MUCH I should allocate if so (don't get me started on the divide in opinion on this!).

So, basically, I am leaning towards just putting the system on the 128Gb SSD, using most of the 3Tb HDD as the /home partition, and leaving a bit on that as SWAP (size debatable). Oh, and for the record, I plan to install the 64-bit version on an i7 machine. So I'd like your opinions on the following:

Do I even need a SWAP partition when I have 64Gb of RAM? People are either saying a Linux system simply cannot function properly without one, or that they don't have one and all is fine. Those in the former category argue that even if you have 64Gb or even 128Gb you should have SOME Swap, even if it is basically a token amount of 6Gb or 16Gb, or even as low as 4Gb. The argument there is that no matter how much free RAM you have, there are apps and processes that will always want to write to Swap. But others say that their auto install never even created a Swap, and they've never noticed anything since they have 32Gb or 64Gb of RAM. Which leads me to:

HOW MUCH SWAP do I really need? Many are still applying the old rule of x2 the amount of RAM, so in this case is 128Gb, which seems ridiculous (on my current system with 4Gb RAM I allocated way too much, as the max I've seen it in use is 2Gb). While many point out the x2 rule is outdated, from a time of low RAM, others still defend it, saying that if you wanted to Hibernate, you still need x2 Swap (for the record, I never Hibernate, which I understand to be more for laptops- on my desktop system, occasionally suspending to RAM is fine for me). And that, actually, even if you DON'T plan on hibernating, you should still have either the same amount of Swap as the RAM, or double it. So, I don't mind creating a Swap partition, but would rather not waste space it will never use (ie: 128Gb is overkill if it only uses 2-4Gb max).

WHERE do I put the Swap? Now, I am aware that writing to SSDs is what wears them down, BUT also aware that current SSDs are much more robust than those from 5 years ago (and my Samsung 850 EVO is apparently one of the highest rated for durability in that regard). I also know having a Swap on an SSD would be faster than on a traditional HDD, and apparently if I put the Swap at the END of the HDD (as I was thinking of) it would make the Swap even slower. One defence I've seen for putting it on the SSD is that since it will hardly be used with large amounts of RAM, there will be basically hardly any wear on the SSD from writes. So would you put the Swap on the SSD, the beginning of the HDD, or at the end of it?

HOW do I do this - Guided or Manually? I've seen advice saying the guided method is all you need, and even with having a separate /home drive is actually the best option (according to one guy, it will create the Swap it needs, but if you do it manually, you will then have to make sure it is more than your RAM [WTF???]). Now, while I am not scared of taking the manual route, if the installer can figure out how much Swap I need (if I even need it), and where to put it, that's probably desirable. And apparently the guided method also allows you to choose where the /home partition is going to be, which I thought could only be done manually. So, do I let the installer take charge, or do I manually specify how much Swap there is, and where it goes?

Many thanks in advance guys!

sudodus
October 27th, 2016, 07:26 AM
Swap

If you want to hibernate the computer, you need swap, at least the same size in Gibibytes as the RAM. I don't hibernate, and I suggest that you skip this alternative. I think that you don't need any swap at all, but some people say that it is a good idea to have some, for example 2 GB (independent of the amount of RAM and on the HDD to avoid excessive wear of the SSD). You will notice if it starts swapping more than some minimal amount because the computer gets slow and then you can close some program.

Home partition

It is a good idea to have a separate home partition on the HDD.

Do the installation manually

Boot into the Ubuntu install drive.

Use gparted to prepare the drives with suitable partitions. Notice that you need GPT to use the whole 3 TB drive.

- Are you familiar with GPT?

- Have you decided if you want to boot in BIOS mode or UEFI mode?

See these links and links from them:

DiskSpace (https://help.ubuntu.com/community/DiskSpace)
Installation/FromUSBStick#UEFI (https://help.ubuntu.com/community/Installation/FromUSBStick#UEFI)

Start the installer, and at the partitioning page, select 'Something else'.

Select the partitions you prepared with gparted.

-o-

Finally, if you are booting in BIOS mode: select where to install the bootloader at the bottom on the partitioning page.

If you are booting in UEFI mode, it wants and uses the EFI partition on the first drive, /dev/sda

-o-

Edit: With a 128 GB SSD you can have the home directory there too (a separate home partition, or as a directory in the root partition), and configure the computer with a separate data partition on the HDD. This is how I use my main computer. I mount the data partition via a line in /etc/fstab, and I back it up separately from the system (the root partition).

Bucky Ball
October 27th, 2016, 07:54 AM
Swap
Largely agree with sudodus. I'd forget hibernate and go for a 2Gb /swap. I always have /swap at the end of a HDD. NEVER on an SSD. I also never have personal data on an SSD. OSs only for mine. All personal data goes on HDDs here.

Home
I never have a /home partition, but that is the way I like it and suits my circumstances. I have a /data partition which is accessed by all my installs, including Windows. In my Ubuntu installs, I use 'Something Else' and partition as I like which is a 20Gb partition for Ubuntu (Xubuntu-core actually) and a 2Gb /swap. I let the /home partition install by default in / during install.

Once installed, I go to the /home folder and delete all folder in there for personal data; /Music, /Documents, /Video, etc. NOT the hidden files and folders, though. I then create symlinks to the existing folders /Music, /Documents, /Video which are on my /data partition.

Therefore, all installs access the same data, no redundancy or duplication, and if I want to back up my install, its small and easy on a 20Gb partition. If I want to backup my psuedo '/home' which is actually my /data partition, I just do a regular data backup. Easy.

There are many options. What sudodus and myself have outlined about our own setups are but two. Matter of your situation and what works for you. We can share the options but we can't know what is ideal for you. Only you can know that. When you have worked that out, you can start to answer some of your own questions. I would grab a pen and paper and beverage of choice and start making a mud-map (rough plan) of what you've got disk-wise and what you want the end result to be.

Post an outline when you get there (and any other time with any other questions, naturally) and see who throws their hat in the air. :)

alexjpowell
October 27th, 2016, 08:13 AM
To add to the above

Don't put the swap on the SSD- it will decrease the life span. As noted above it's only required when hibernating also. I just "suspend". Never found any real benefit to hibernation.
I'd install the OS & /boot partition on the SSD and then I'd also put any critical applications on their as well (Chrome)
64GB of RAM is really quite a lot so if there is going to be significant redundancy there I'd set up a 2GB RAM disk and put the swap on that. Of course- this isn't going to work well if you're hibernating. I'd also create another RAM disk and put your /tmp there and then any other application caches that don't need to survive a reboot. The size will be however much you require.

Looking at my own Facebook Machine with 8GB of RAM and my /tmp & application caches going into a 2GB RAM disk, my swap usage (on my HDD) is less than 20MB so it's probably not even worth worrying about. I don't reboot it either, just suspend so it's not like I just started it up and quoted that number

OzzyFrank
October 27th, 2016, 08:26 AM
Swap
- Are you familiar with GPT?
- Have you decided if you want to boot in BIOS mode or UEFI mode?

Hi, and thanks for your advice. Regarding GPT, I am not actually familiar with it as such, as this will be the first time I've used over 2Tb for an internal/system drive, but I did recently buy a 3Tb pocket drive (formatted to NTFS, of course), which I then plugged in while in Ubuntu and used gparted to turn it into an EXT4 partition/drive. So that's the other reason I ham not familiar with GPT - I didn't need to be. Gparted just saw the whole 3Tb NTFS partition, and let me turn it into a 3Tb EXT4 one with no fuss whatsoever. Since the Ubuntu installer uses gparted, I gathered that it could deal with the 3Tb drive no worries. As for using gparted to create and format partitions before using the installer, I'm actually used to doing that, but just figured I didn't really need to, since the partitioning options in the installer have come a long way since 2006.

BIOS or UEFI mode? Once again, this is for first PC with UEFI, and the only experience with it is helping a few dual-booters install and boot into Ubuntu on machines with Windows 8 preinstalled. Since I no longer wish to have a dual-boot machine, my question is: is there any reason to install Ubuntu in EFI mode on an Ubuntu-only machine? I have actually tried to look that up, but all I find is the how, not the why. Basically, I am happy to switch off secure-boot etc and install Ubuntu in "legacy mode", unless there is a reason installing in EFI mode is superior.

Bucky Ball
October 27th, 2016, 08:36 AM
is there any reason to install Ubuntu in EFI mode on an Ubuntu-only machine?

None whatsoever.

Difference is this, to keep it simple.

EFI: You can, theoretically, have as many partitions as you like on one physical drive. Primary or extended.
Legacy (BIOS mode): You can only have four partitions per physical drive, primary or extended, BUT the extended partition overcomes this limitations as you can, theoretically, have a heap of logical partitions inside that.

Important to note that a Ubuntu install will happily live on a logical drive inside an extended partition. Windows will not and needs to be installed on a primary partition.

OzzyFrank
October 27th, 2016, 08:49 AM
Bucky - good idea re the /data partition, but I'm guessing you had to format it to NTFS so Windows could access it (which really isn't ideal - it's a rather primitive filesystem). I sort of do the same with my current dual-boot system - not a separate partition, but stuff in folders on my Windows partition which I easily access in Ubuntu. I even have bookmarks in the left-pane of Nautilus to some of those folders. However, it's kind of silly now, since I never use Windows. Or, rather, I never boot into it - I have a Window VM I open up in Virtualbox for a couple of programs.

Alex: I plan to put everything system-related, as in everything but the /home folder, on the SSD. Well, not the swap, but all programs end up there anyway, since generally they're all in /usr/bin etc. Most programs have the stuff they write to in the /home folder/partition, notably things like Firefox's profile folder, so basically most will load quickly off the SSD, and write to the HDD for temp caches and saved bookmarks and whatnot. As for RAMdisk, after my last upgrade, Ubuntu basically did that even though I didn't get a say in the matter. Probably not a bad idea on this crappy system, but on the one I'm about to build in the next day or so, I'll see how I go - and Ubuntu might even automatically make them anyway. I admit ignorance for the most part when it comes to those, and an hoping with 64Gb of RAM, I won't need to worry about them.

OzzyFrank
October 27th, 2016, 09:04 AM
Bucky: Cool, thanks. I no longer plan to use single drives to house multiple OSes, or even have multiple partitions on them, so I can just switch to legacy-mode in the UEFI, and install Ubuntu as I always have - with a good old MBR, and not have to worry about reading up on EFI boot partitions.

So, now the question is should I do all the partitioning in gparted before the install, or will the installer's partitioner easily let me create what I want (which is basically all the system bar the swap and /home on the SSD, and the swap at the end of the HDD, with /home taking up the rest)?

alexjpowell
October 27th, 2016, 09:06 AM
The RAM disks are not a must at all but things like installing software / updates and loading Spotify are faster with /tmp and /home/user/.cache/ on the RAM disk for sure
I've gone as far as to install a lot of my applications into the RAM disk as well which I would never recommend but I don't plan on rebooting it any time soon and the extra .01 seconds to load makes me feel better

OzzyFrank
October 27th, 2016, 09:30 AM
the extra .01 seconds to load makes me feel better

Haha - but on the quantum level, those .01 seconds are an eternity! But I've found Ubuntu doesn't really need my input re /tmp folder and temp caches and the like - I even have 4 ZRAM thingies that were just suddenly there one day. But - hang on - I just realised it will put /tmp and whatnot on the SSD - faster, for sure, but increases the writes on it. But that 850 EVO has a write-life in the petabytes, and my son has his Windows system (all but C:\Program Files\) on a much older and cheaper SSD, and that's still going fine (and we all know how heavy Windows updates can be!).

But maybe I should look into creating a /tmp partition on the HDD, as well as the swap and /home? Or is that overkill? I mean, for the most part, the SSD will only be read from, so some activity in /tmp shouldn't drastically decrease the life of the SSD (?).

sudodus
October 27th, 2016, 09:37 AM
Since I no longer wish to have a dual-boot machine, my question is: is there any reason to install Ubuntu in EFI mode on an Ubuntu-only machine? I have actually tried to look that up, but all I find is the how, not the why. Basically, I am happy to switch off secure-boot etc and install Ubuntu in "legacy mode", unless there is a reason installing in EFI mode is superior.

No, you can continue with BIOS (as long as your computer's system will allow it) :-)

BIOS is simpler and I see no advantage with UEFI. I think UEFI is used by big companies to lock the computers to their systems. In theory there are advantages, but it is often tweaked outside the official specifications.

Bucky Ball
October 27th, 2016, 09:39 AM
Bucky... I'm guessing you had to format it to NTFS so Windows could access it (which really isn't ideal - it's a rather primitive filesystem).

You need not such hindrances. ;) Ubuntu only, EXT4 would be where I'd be going. I have Win8 (from memory) on this machine but no NTFS data partition as Win only used for the odd hardware configuration app when I can't get something working in Ubuntu (like my wireless printer). In reference to an earlier comment re. having one partition per HDD; on this machine, both OSs on a 128Gb SSD and three 1Tb HDDs for storage with ONE BIG partition on each. :)

OzzyFrank
October 27th, 2016, 09:43 AM
UEFI is used by big companies to lock the computers to their systems

That's pretty much the only "benefit" I've seen, and I have done a fair bit of reading up on it since buyers of Windows 8 machines started screaming that it wouldn't let them install Linux (or they could install it just fine, but not actually boot into it). Yep, I'll just stick with the legacy mode.

alexjpowell
October 27th, 2016, 10:25 AM
RE: what you put on the SSD

It probably doesn't matter
It's just nice to talk about what's best

oldfred
October 27th, 2016, 03:40 PM
I prefer to only partition in advance with gparted and make sure you select gpt first. I have used gpt since 10.10 and then booting in BIOS mode. With Windows XP on MBR drive. When you partition in advance you still have to use Something Else install option.

If you never use swap how can you wear out SSD? Never understood that argument.
I am in the camp of at least some swap. For whatever reason I had swap on every drive, but my installs then auto find both and I comment out the other one. I do have multiple installs on every drive. And make sure at least one on other drive is fairly current as emergency boot.
Some user that seemed very knowledgeable commented that swap really required some % of RAM like 80% and commented that swapfaqs was wrong but he did not have rights to edit.
But there may be exceptions like video editing where you cannot have too much RAM and may then need larger swap. And then SSD would probably be better as faster, but still orders of magnitude slower than RAM.

Also now SSD have life similar to hard drives, both of which is not forever. So if life is comparable it should not matter what is on SSD or on HDD.
Small sample, so not totally valid.
http://hothardware.com/news/google-data-center-ssd-research-report-offers-surprising-results-slc-not-more-reliable-than-mlc-flash
SSD life test 2015 final
http://techreport.com/review/27909/the-ssd-endurance-experiment-theyre-all-dead


GPT Advantages (older 2010 but still valid) see post#2 by srs5694:
http://ubuntuforums.org/showthread.php?t=1457901
https://wiki.archlinux.org/index.php/GUID_Partition_Table#Advantages_of_GPT
http://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface
http://askubuntu.com/questions/629470/gpt-vs-mbr-why-not-mbr
UEFI Advantages
http://askubuntu.com/questions/647303/uefi-or-legacy-which-is-advised-and-why/647604#647604
http://askubuntu.com/questions/446968/legacy-vs-uefi-help
http://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface

kurt18947
October 27th, 2016, 04:21 PM
The *buntu installs I've done on machines with adequate RAM - 4 GB+ - seem to work fine without swap. On machines with marginal RAM, I've created a swap file. This has worked well for my purposes. I've noticed small amounts of swap being used when a swap file was present though usually not more than a couple hundred MB. I doubt that a swap file would work for hibernation though I've never tried it Hibernation has been unreliable in the past and either suspending or shutting down has worked fine. I don't have many programs open at once nor do I run large/demanding programs so that may affect my experience. I've installed htop to help monitor RAM & CPU usage so can tell if I'm 'pushing my luck'.