Hacker News new | ask | show | jobs
Ubuntu 16.04 Partition Scheme on a Single Internal SSD?
3 points by lagbaja 3243 days ago
Hi,

I recently purchased a "Samsung 850 EVO 500GB 2.5-Inch SATA III Internal SSD " to replace the 500GB HDD, which came originally shipped with my ASUS Zenbook UX32VD.

I have done a tonne of research online, as to how best to apply a partition scheme to an SSD and what i found is a lot of conflicting and confusing information, such as some schools of thought echoing the use of TRIM and No SWAP partition due to the quick wear that can have on the SSD, whilst some are proponents of just creating one large partition without any customization and yet another camp that rather implement an SSD + HDD configuration, which will not work in my scenario, as i just have a one Drive bay on the motherboard, plus the ASUS does not have a CD bay i could have re-purposed.

Your advice as to how to best tackle this will be much appreciated.

NB: I'm primarily going to be using the system as my development system (Python centric Projects)

Cheers.

5 comments

I've been goofing around with Linux over the last seven years or so starting with VM's and going to dual boot about three and a half years ago and going with Linux as my primary OS about three years ago. This is where I am at with my partitioning:

  0. Must have: /home and a swap.
  1. Proven to be useful: /boot, /
  2. On the fence: /usr
  3. Not worth it for me: /tmp, /opt
Without /home, upgrading and running multiple distros on the same machine are more pain and riskier. Having a separate swap makes having separate distros easier.

Using /boot seems to play better with UEFI Bios options or rather it reduces the entanglement of a UEFI Bios options with the rest of the system. Having a / partition then sort of falls into the crack between /home and /boot.

I'm currently using a /usr and until I upgrade or swithc, I won't really know its utility. It hasn't really proven to be a headache. /tmp was a headache because getting the size right (not to much, not to little) was just a system admin chore for no gain...but again, that's for me running Linux on a workstation.

Regarding wear and tear on an SSD, hoping the drive won't fail is not really a backup/reliability strategy. With adequate RAM a swap partition may not see much use, anyway. If it does, the price of a replacement SSD in a few years will probably be low compared to current cost. My experience with hard disks and SSD's is that I tend to wind up with more of them than I use over the years. YMMV.

Good luck.

Brudgers, I thank you. Cheers
Here's how I set mine up:

512MB to 1GB: /boot (ext4)

25GB to 50GB: / (root1, whatever filesystem you want)

25GB to 50GB: / (root2, whatever filesystem you want)

The rest, minus 20GBs: /home (whatever filesystem you want)

Having a separate /boot allows for running experimental file systems on your / partitions without needing to worry about GRUB not being able to boot them.

The two / partitions makes upgrading way easier. I've never had good experiences with distro's built-in upgrade mechanisms, so I always do clean installs, alternating between which root partition I install to. This means you've always got a working system as backup if the install fails for whatever reason. It also also makes it much easier to try out new distros (or BSDs, whatever), if you're into that.

Finally, a note about why I always leave 20-ish GBs free (as in unpartitioned; not just free space within a partition). This has to do with how SSDs do wear leveling. Consumer SSDs typically come about 7% overprovisioned, usually, this is the difference in size between measuring GBs as 1024MBs vs 1000MBs (the actual flash capacity on the drive is with the 1024MB measurement, but the marketed size you're buying is with the 1000MB measure, to remain in-line with how HDDs are sold). In short, the SSD controller uses this "scratch space" to perform its wear leveling, as well as keep performance up. The bigger the scratch space, the better the controller will perform (this is why enterprise SSDs typically are closer to 15% or 20% overprovisioned).

So, by leaving that extra 20GBs or so unpartitioned, you're simultaneously increasing the life and "steady-state" performance of your drive. The lost space is a small price to pay for peace of mind IMO. If it interests you, for the nitty-gritty details of why this is so, Anandtech has a great (albeit long) write up: http://www.anandtech.com/show/2738

EDIT: It used to be that you also needed to worry about partition alignment for optimal performance, but as long as you're using a modern distro's tools to do your partitioning, they now take care of getting the alignment right for you.

Hi Peller,

Thanks for such detailed explanation much appreciated.

Cheers

I wouldn't worry so much about the swap causing wear. You can look up your SSD's expected lifetime, but recent controllers are very good at wear leveling and you probably won't even get close to wearing it out. Anyways you're probably not going to do a ton of swapping. Even with python ;)

Definitely use TRIM. It will probably be enabled by default anyway.

I have exactly the same drive in my new System76 system.

    /dev/sda1       2048   1050623   1048576   512M EFI System
    
    /dev/sda2    1050624 968382463 967331840 461.3G Linux filesystem

    /dev/sda3  968382464 976771071   8388608     4G Linux swap
Hi Mattl,

Thanks a bunch for taking the time to read and respond to my questions, much appreciated.

Cheers.

A good way to minimize swapping is to adjust the swappiness setting and set it to something low. I have it set to 10 so it won't start swapping out until RAM reaches 90% utilization. Edit or add (if it's not there):

vm.swappiness = 10

...to /etc/sysctl.conf. You can change "10" to whatever works for you. The number is the percentage of free RAM before it starts swapping. You can also change it on the fly with:

sysctl vm.swappiness=10

...but you have to add it to the sysctl-conf file to make it permanent.

Hi Microwavecamera, thanks for the information, appreciated. Cheers
For swap, instead of using a partition for it, you can have a file, or several files of swap in your root partition. This way, the swap files will be handled as other file, and TRIM can do its job.
Hi Libx, I thank you. Cheers.