Recommended size in percentage for each partition - Ubuntu 18.04

43,254

Solution 1

There's no hard and fast rule for this, just rules of thumb. Like a lot of others have said, it is truly based on what you will do with this system. There are also a lot of filesystem options. For the most part, stick with ext4.

Note: Dropbox on Linux now requires ext4. I believe that no longer allows encrypted home directories, either.

Here's some of the other options:

  • ZFS - Originally developed for Solaris, later ported to BSD and Linux. This is typically used in servers with RAID setups, like FreeNAS (FreeBSD-based). Has advanced file system features, de-duplication (very RAM heavy) and copy-on-write (CoW). There were some licensing issues that were recently ironed out. Not currently recommended (2018).

  • JFS - Originally developed for IBM's AIX, and later ported to Linux. It was a journaling file system before ext4 entered wide use. According to RedHat, it has not seen active development for a decade, and they plan to remove the modules for it at some point in the very near future.

  • XFS - Originally developed for SGI's IRIX, later ported to Linux. At one time, Fedora installs recommended it. While better for large media files, it has some downsides in that it cannot shrink, nor does it gracefully handle power outages.

  • ReiserFS - A series of file system by Hans Reiser. It is now abandoned. Don't use, although it did handle small files efficiently.

  • vFat or FAT32 - 2GB file limitation, 2TB partition limit (limited to 32GB in Windows), although larger partition sizes will suffer from wasted slack space when used with many small files.

  • NTFS or ntfs-3g - Windows NTFS. Good for cross-platform file transfer. Some overhead is incurred by writing to NTFS volumes.

  • FFS - BSD Fast File System (ReadOnly). Hopefully you will not run across one of these. Available purely for compatibility purposes. If you do run into this, it can be in 'dangerously dedicated mode', i.e. no disklabel. FFS handles partitioning (slices) internally. [note: that dangerously dedicated mode has been discouraged since at least 1999]. I believe most *BSD systems have transitioned over to ZFS, and can boot from it now (as of FBSD 8). FFS/UFS support is deprecated has been removed from modern kernels.


swap

In the really early Linux days, it was recommended that swap be 2x system memory. But in those days, the system memory was 4 to 8MB. Now, you can easily set it to 50% to 175% of system memory. You'll want more than system memory if you hibernate. Some users - especially those with single SSD drives forgo swap entirely to lengthen the life of the SSD.

boot

For historical reasons, a separate boot partition was created to get around the first BIOS limitations - first a 128MiB limit, then a 512MiB limit, then a 2048MiB (2GiB) limit, and so on. If you are setting up Linux on obsolete hardware, you'll want to keep this in mind. Also, obsolete Linux will typically require ext3 instead of ext4. Additionally, if your OS drive will be encrypted, then you'll require a separate boot partition. Otherwise, no.

opt or app

The home of externally installed software. Only use this if a vendor requires it. FWIW, Lately, I've been seeing a lot of vendors symlink opt to app (and vice-versa)

var

In the old days, for performance reasons, you'd want this mounted with a ReiserFS filesystem (small text file efficient) with noatime set so that logging functions would not have to bother with updating the access time after every single log file write. I recommend sticking with ext4 over ReiserFS now, and the noatime speed boost is negligible compared to the additional complexity of maintaining yet another filesystem. If you absolutely insist - 5GiB to 10GiB. You'll need enough to download the debs/rpms/ypkg that you'll need to upgrade the system. Contents of /var are very important, as you'll usually have the package database here. Lose that, and you will spend a great deal of time recovering from it. Also your logs and your print spool is here, and possibly database information and website, so bump the above number accordingly.

tmp

I would not split this out anymore. 512MiB to 2GiB tops.

usr

Personally I find no benefit to splitting this out anymore. If you really want to, and your OS takes up about about 10 to 15GiB, you'll probably want at least 30 to 35GiB of space in case you need to do a system upgrade.

root

I would go no smaller than 10GiB if you split everything else out. If you don't, just add those other sizes back into the previously mentioned 10GiB minimum.

home

Just give it all that is left.

disklabel

One last thing to mention is the disklabel. If the disk is in a machine with BIOS, you must use the MS-DOS disklabel, complete with the 4 partition limit (extended partitions help with this), and one of the requirements is that /boot or / exist as a primary partition has been marked as bootable. You can also use a MSDOS disklabel if you have EFI with CSM modules enabled.

Otherwise, you should use GPT with an EFI enabled bootloader.

I'm not so knowledgeable on bootloaders and disklabels, so feel free to correct me.


TL;DR Not giving percentages because the sizes of OS requirements don't typically change that much from generation to generation.

swap  - 0% to 200% of system memory.
/boot - if needed, 2.5GiB or less.
/opt  - only if explicitly needed. Size as req'd
/app  - same as opt
/var  - only if needed, 5 to 10GiB
/tmp  - put it on root, otherwise 512MiB to 2.5GiB
/usr  - put it on root, otherwise 35 to 40GiB
/     - (root) 10GiB min (if other parts used), otherwise 65GiB
/home - Whatever is left

----- What I use on my non-work computers -----
/     - 65GiB
swap  - no more than 100% of system memory
/home - Whatever is left

Solution 2

seriously, why do you need this kind of separation for each mount point. if its your personal computer,then there's actually no need to do this. Linux file system is too cool with that. you can just separate your / partition,swap area and /home partition and if there's requirement then the /boot. and this is totally fine. no need to have so many separate partitions.

Share:
43,254

Related videos on Youtube

theapache64
Author by

theapache64

Updated on September 18, 2022

Comments

  • theapache64
    theapache64 over 1 year

    Let's make it clean and simple. I've 4GB of RAM and 500GB of HD. What's the recommended size for swap,root,/boot,/var,/opt,/home,/usr and other mount points.

    NOTE: Size in percentage would be helpful to others with different configuration.

    • Byte Commander
      Byte Commander almost 6 years
      Why would you like to split these all into separate partitions anyway? For home systems, one generally either allocates all as / and uses a swap file on it these days, or allocates a small swap (e.g. 4GB, like RAM size) and the rest /, or maybe separate /home (remaining space) from / (maybe 50 GB?). All these are just personal recommendations though, which might not be optimal for some use cases.
    • Rinzwind
      Rinzwind almost 6 years
      What is the use case for this machine? /var, /opt, /usr? Are you intending to use this as a server? If so: do not make any partitions and leave it with just "/". Partitions are only a hindrance on a server. If a home desktop: "/" and no "/home". Make a data partition and use that for personal data.
    • Rinzwind
      Rinzwind almost 6 years
      "recommended size" that does not exist since any partition needs the amount of space based on what YOU do with the system. I can live with 10Gb on / since my mysql and apache data are on a /discworld partition as my personal data from /home/{dirs}/ is.
    • theapache64
      theapache64 almost 6 years
      bCommander and Rinzwind : I was just curious about the usage of the options specified in the installation wizard. I had lot of questions in my mind and most of them are answered by your response. Thank you so much. Peace.
  • The Dude
    The Dude almost 6 years
    I personally use this scheme myself as it makes it easier to do a fresh install or OS switch - no backing up home required. Only catch is your user folder may have to be moved (or a different username used) or you might not be able to log into your desktop. Causes of this can vary from the obvious (encryption of the home directory, user id mismatch), to the obscure (changes in the .gnome/.kde/.local files prevent login from completely succeeding, desktop crashes, etc...)
  • Mahesh
    Mahesh almost 6 years
    good to hear that. and surely, the user folder freaks me out too!
  • The Dude
    The Dude almost 6 years
    When I have trouble logging into my desktop (no window manager, no window chrome, crash to lightdm/gdm3), it almost always stems from trying to use a different distro's user folder. Except with this last upgrade from 17.10 to 18.04 I had the same problem. I resolved it for myself by switching from lightdm to gdm3. I guess gnome has so many hard systemd dependencies, just using lightdm to log in doesn't do enough systemd-logind-whateverd setup for Gnome. (This version of Ubuntu hasn't had a fresh install since 'precise' or 12.10)