73

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
  • 29,597
tinker
  • 979

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,443
  • 1
  • 12
  • 15
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
  • 73,717
Evan
  • 5,068
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,443
  • 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,495
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,616
Asmerito
  • 376
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,616
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,616
charlie-tca
  • 1,269
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,616
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
  • 592
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,443
  • 1
  • 12
  • 15
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,616