72

What partitioning scheme do you recommend for a desktop? I've always created three or four primary partitions -- root, swap, home, and sometimes a separate boot partition. Ubuntu's default install offers LVMs. I've never had to add additional drives or space, so it never seemed like a big deal. Whenever I do a fresh install, though, I always think there might be a better way.

LiveWireBT
  • 28,763
tinker
  • 969
  • 1
    You may, for quick backups, include a backup partition (ext4) and use clonezilla for regular backups of the root directory (excluding home) before updating your system. – Renae Lider Oct 02 '14 at 10:19
  • That's a shame it's "opinion-based". That's true that some answers are opinion-based, but there should be a way to answer this question with arguments, making it non opinion-based. – Quidam Apr 24 '20 at 12:17

11 Answers11

78
  1. / (i.e. the root filesystem)
  2. swap
  3. /home

The biggest reason to do this is that you can do anything to your Ubuntu install and it won't affect your music/videos/whatever in your home. I especially enjoy this when a upgrade to a new Ubuntu version and the installation goes weird.

gth
  • 1,433
  • 1
  • 12
  • 15
  • 4
    I think this is the best approach, as you can separate the OS install from your own data. However, the final answer will be "whatever suits you best". – Jeremy Kerr Jul 29 '10 at 03:33
  • I didn't consider upgrades, probably because I mainly use ubuntu for work where I don't have a bunch of my personal files that need to stay around.. I like your approach best. – mfisch Jul 29 '10 at 03:41
  • 3
    I also use this partitionning scheme. On your server I would also add a /backup one if some backups trategy is needed. – Pierre-Yves Gillier Jul 29 '10 at 08:50
  • 3
    for desktop purpose I always use this solution. 20-30% root / 70-80% home /home 1or2 GB swap – neuromancer Sep 10 '10 at 11:45
  • +1 This is extremely for all the reasons Bittink described. If you want a setup that plays nice with windows, make the home partition NTFS, set the partition to automount on boot and symlink whatever folders you use to your home directory. – Evan Plaice Sep 16 '10 at 09:18
  • 2
    @Evan: is it even possible to mount an NTFS partition as /home? Wouldnt that be chaos since NTFS has no linux permitions? Arent those needed for /home? – MestreLion May 27 '11 at 00:33
  • @MestreLion Yes and No. I have an additional /Home partition because I don't usually like to carry over all of the excess application settings when I wipe the OS. What I do is, create a NTFS partition for all of my Home folders (docs, public, etc) and symlink them into the actual /home folder which exists on an ext3 fs. It's the most convenient and transparent way I've found yet to use a NTFS partition as /home, you just need to set the permissions correctly in fstab to allow all permissions for the NRFS drive or you'll eventually have some issues. – Evan Plaice May 29 '11 at 23:31
  • Could anyone care to explain, why a separated partition for /root? root has 5% of the drive for itself guarantee, so I don't see why use separated /root. In fact, most people don't store stuff in /root. – Braiam Sep 04 '13 at 02:00
54

Generally speaking, you shouldn't bother with a separate /home or /boot partition unless you're running multiple Linux distributions at once.

The Ubuntu installers for both the desktop CD and server/alternate CD have the ability to install over an existing system, preserving your home directory (and the local system driectories: /usr/local, /usr/src, and /var/local). This functionality also reuses the user ID and group ID of an existing user, if it has the same username as the user you're creating during installation.

To use this option when installing, choose the option for advanced partitioning, then select your existing / or /home partition. In the box that appears, make sure the filesystem selected matches the existing filesystem of that partition, and that the format box is not checked. Proceed as normal through the rest of the options.

In Ubuntu 10.10 we had hoped to add an option to the installer that detected when you had an existing copy of Ubuntu installed and offered to replace it with the newer version you were attempting to install (using the aforementioned functionality behind the scenes). While it did not make the final cut, it is likely to arrive in Ubuntu 11.04.

As for a separate /boot partition, that's a relic of hardware constraints of the past (the bootloader 1024 cylinder limit). I can think of no practical advantage a separate /boot would have on a modern system, and if not given an arguably excessive amount of space, it will potentially fill up and create problems of its own, given that Ubuntu does not automatically remove old kernels.

Jorge Castro
  • 71,754
Evan
  • 5,048
  • 1
    When you blogged about this Jorge, I disagreed. I like the idea of the simplicity offered by one root partition, but it's very convenient to put /home on a separate partition in the case that during a full re-install of Ubuntu, I can ask that / is formatted, while /home isn't. – Scaine Oct 12 '10 at 19:20
  • 3
    That has roughly the same effect as not checking the format box on /. It obviously doesn't format the partition, but it removes the system files present before starting the new install. – Evan Oct 12 '10 at 19:39
  • 4
    There are numerical advantages to have a separate /home partition. You can perform a clean system install by formatting the root partitions but still keep your data. You can use either encryption or LVM on the /home, but you probably don't need that for the root one. For backup simplicity, you just make a dump of the /home partition. For power user, you can tweak your system and choose different file system for the applications and for the data (which make sense also). Etc. – Huygens Oct 12 '10 at 20:11
  • 2
    Another important thing about /boot: if you have to recover the system, you can't be sure what your recovery tools will support. If you use something like XFS on LVM for your basic install, you can use a simple ext3 on the raw partition on /boot - which even the simplest recovery tools should support. – Mei Aug 23 '11 at 14:24
  • 3
    Separated /boot partition became mandatory since the EFI/UEFI mess. – Braiam Sep 04 '13 at 02:01
  • 2
    On MBR with preinstalled Windows, separated /boot allows you to remove Ubuntu without having to restore the Windows bootloader. – ignis Mar 28 '14 at 07:47
  • I disagree with the /boot not needed, but also with the /home partition not needed. Maybe for you, but I really appreciate to keep my data in case of problems, or forced reinstallation! – Quidam Apr 24 '20 at 12:11
13
  1. / (i.e. root filesystem) - for your operating system

  2. swap - swap space, which should be a little larger than the amount of RAM you have

  3. /home - for your data files

You only really need a separate /boot partition if you are using the alternate installer to set up full disk encryption. Currently the files in /boot need to be unencrypted so the operating system can start.

Generally speaking, you might add other partitions if you want to:

  1. Preserve the partition through a re-installation of the operating system - this is the usual reason for having a separate /home partition. A separate /usr/local or /opt might also be useful if you install lots of applications by compiling them from source.

  2. Limit the space that files on a partition can use - for example, a separate /home partition will prevent your operating system grinding to a halt when you fill up your home directory because you will still be able to log in as root and delete some files from your home directory.

  3. Use a different file system - I use a faster, less resilient file system for /tmp, but I keep /home on a slower, journaling file system for better data protection.

As suggested by Asmerito, you should consider putting all your partitions other than /boot on LVM. This will allow increased flexibility in resizing your partitions or even expanding them on to other disks. But you might not expect to require this functionality.

If you use the full disk encryption in the alternate installer, it will automatically create a /boot partition, a swap partition and another partition to hold the encrypted data. This encrypted partition is then used to hold a LVM partition. This LVM partition is then used to hold all your additional partitions. Initially this is just your root partition.

Hope this all helps.

gth
  • 1,433
  • 1
  • 12
  • 15
10

Well, at a minimum you need a root partition and a swap partition. I highly recommend a home partition because then when you run out of space on your home partition, it won't affect your applications and more importantly, core components.

I discovered this the hard way when I ran out of space on the root partition - and I couldn't even start the Gnome desktop. I had to log in through the terminal and delete some stuff :(

Nathan Osman
  • 32,155
  • 1
    That shouldn't happen in recent versions of Ubuntu - we now ensure there's always some room in /tmp (where these apps need to write). – RAOF Jul 29 '10 at 04:19
  • @RAOF: This happened with Ubuntu 9.04. I'm of course using 10.04 now. – Nathan Osman Jul 29 '10 at 04:50
  • 4
    You don't really need a swap partition either, if you don't plan on ever using suspend to disk. – Marius Gedminas Sep 11 '10 at 08:57
  • If the kernel crashes, it wants to write a memory dump. If there is not enough room, it won't (but it won't hurt anything otherwise). The kernel crash dump can then be analyzed later - it's copied from swap on reboot. – Mei Aug 23 '11 at 14:27
  • Isn't the /swap very useful when you have very low RAM? – Quidam Apr 24 '20 at 12:14
8

For server installations, best practice is to use LVM, so you can expand your storage space easily if you run out of free space. My suggestion is:

  1. /boot
  2. /
  3. LVM (if you add more disks, just resize LVM and there you go).

NOTE: if you use multi-user environment, it is good practice to create /home on LVM.

Aditya
  • 13,416
Asmerito
  • 366
7

I use:

Primary partition:

  • /boot = 1 GB

Extended partition with LVM:

  • / = 5 GB
  • /var = 3 GB
  • /var/spool/cache = 2 GB ReiserFS (local squid disk cache for all my browsers)
  • /home = +500 GB for users including a public folder (shared both locally and remotely with smb).
  • /tmp = 128 MB (ramFS).
  • swap = twice my RAM.

I've been using this scheme for years and I'm very happy with it. Suggestions always welcomed.

Aditya
  • 13,416
  • You don't need that much for /boot. Unless you have loads of kernels installed. 256 MB is sufficient. If you have only 2 partitions the /boot and the LVM, then you don't need to create the LVM partition in an extended container as you can have up to 4 primary partition on the old-but-wide-spread MBR. Unless you don't have much RAM, you don't need the 2RAM=swap scheme, if you intend to have hibernation and have sufficient RAM for your workload, then 1.1RAM=swap is good enough. If you have 8 GB RAM and don't do heavy video edition, then you can have as little as 1 GB swap (or even no swap). – Huygens May 21 '12 at 07:45
  • That's so many partitions. – Quidam Apr 24 '20 at 12:15
6

On my home server, I prefer to create /, /swap, and /var/log. Since I do run a firewall and log all activity to /var/log, creating the log as a separate partition ensures that even if the logs run rampart, it won't block me from booting.

Aditya
  • 13,416
charlie-tca
  • 1,249
4

If you plan to install several distributions and want to use the same home folder you can install with a separate /home partition and use the same username for each distro. But if you are only using Ubuntu there is no need to have a separate /home partition.

Aditya
  • 13,416
4

I always do a fresh install of newer versions of Ubuntu, so for me it makes sense to have a separate /home, since I won't have to backup my home folder every time.

Victor
  • 594
  • 2
    I'll add that this was especially useful for me now that I've moved on to Arch Linux instead, so that I could just replace the operating system and keep all my data without much effort. – Victor Aug 06 '14 at 22:12
  • 1
    The problem with many answers here, is that they don't use multiboot, and they consider only the case of people who don't use multiboot. – Quidam Apr 24 '20 at 12:15
1

On my Notebook Desktop:

  • 8GB allocated to / (i.e. root of the filesystem)

  • 2 times installed RAM allocated for swap (e.g. 3GB RAM = 6GB allocated for swap)

  • Remained of disk allocated to /home

gth
  • 1,433
  • 1
  • 12
  • 15
  • I think the 2 times installed RAM rule doesn't apply anymore, with modern RAM computers. – Quidam Apr 24 '20 at 12:16
  • Yeah that would mean 64 GB of swap space for me, not sure I'm willing to provide that. Probably 64 GB of RAM next build I make, so then that would be 128 GB of swap. That's a no. – Victor May 22 '22 at 16:07
0
  • /root
  • swap
  • /mnt/storage -- somewhere to store any media that you download. If it gets full if won't fill up root. (I guess that this is similar to the idea of making /home a separate partition.)
Aditya
  • 13,416