A Quick Guide to Linux Partition Schemes

What partition setup should you use when dual-booting Windows and Linux? Should you have a separate partition for /home? Why do some people put /boot into its own partition? These are the questions that have plagued mankind since the dawn of time (or thereabouts). This guide aims to answer some of those questions and demonstrate some partition schemes that may save you some space, hassle, or data loss down the line.

I should note that we won’t be covering the “how” of partitioning, but the “why”. There are multiple reasons for this. For one, the specifics of how will vary widely from system to system and there is no way I can know what would work best for your particular setup. Also, in all honesty, I don’t want to be responsible if the partitioning goes wrong and you lose that video file with the alternate ending to Quantum Leap.

Note: For the sake of simplicity, all the charts in this guide will be based on a 100GB drive, and will not show the swap partition. If you follow any of the schemes shown here, you’ll probably want to add a small swap partition in there somewhere. I usually stick mine at the end of the drive.

Windows Dual Boot

With the right partition setup, dual booting with Windows is a breeze. With a poor setup, it can be an infuriating pain. The most important thing to note when planning a dual-boot setup is that many versions of Windows expect to be the one and only OS on the system. Often, Windows doesn’t like being on anything other than the first partition of the first drive, and will not hesitate to wipe out anything in its way. You’ll save yourself a LOT of trouble by knowing this ahead of time and allowing Windows to occupy that slot before installing Linux.

In this example, we’ve created a 50GB Windows partition as the first partition on the drive. Install Windows first, and once it’s all finished, go ahead and install your Linux of choice on the remaining space. Just about any modern Linux will see the Windows installation and automatically add it to your boot menu.

/home

One of the most common setups for Linux is to separate /home partition. There are several advantages for this. The first is that it lets you limit the amount of space that can be taken up by user files (this will be a common theme among the setups discussed here). More importantly, keeping these files separate means whatever may happen to your system files (in “/”) your home will be left alone. This means that you could reinstall your entire OS, but leave your application and desktop settings exactly the way they were.

For example, let’s say you’re running Ubuntu 9.04 with /home as its own partition. You’ve got lots of files saved in your home along with all your desktop settings, Firefox bookmarks, conky config, etc. If you decide to reinstall or upgrade, you can wipe the whole system while leaving your home intact. Once the reinstall/upgrade is done, you’ll have all your files and settings just the way you left them.

You can, of course, adjust the sizes of the partitions to meet your needs. If you don’t plan to install many programs in the root partition, you can drop that down to 10 or 20 GB and leave the rest for user files, or vice versa.

/boot

Many people set up a small boot partition separate from the root. In my experience, this comes in handy if you’re running multiple distros on the same machine. Since the /boot partition is where Linux stores the kernel and GRUB menu, this lets you share boot information across both distros. If you like to build custom kernels (more fun and easy than it sounds) you can place your custom kernel in the boot partition, and let both distros run off a single custom kernel.

The /boot partition does not need to be large. Unless you plan on loading up tons of kernels, 100MB should probably do the trick just fine.

/usr

Another common technique is to give /usr a partition of its own. A lot of things live in /usr, like most of the binaries you’ve added after the initial install. If you want to put a limit on the amount of space that can be taken up by user-installed programs, this is one way to do it.

Since so many things live in /usr, you’d want to give it a fair amount of space.

/var

A common practice on servers is to put /var into its own partition. This is usually done to keep a lid on the amount of space that can be taken up by things like log files.

Exactly what size to make the /var partition can vary widely depending on how you use your system. Most desktop Linux users probably shouldn’t need to worry about a /var partition.

What NOT to Partition

There are some parts of the filesystem you want to keep in root. Items in /bin, /lib, and /etc are often needed immediately at boot time, and if they’re on separate partitions, they may not be mounted before they’re needed. For example, /lib usually contains some kernel modules that will likely be needed immediately upon booting the kernel. If the partition is not yet loaded, things could get nasty.

Some say that /usr could fall in this same category. I’ve personally never had a problem with a /usr partition, but that may be something to keep in mind before you start chopping up your drive.

Related Ebooks

17 comments

Adesays

Good article which has made me want to move my home folder to a seperate drive, but how exactly do I do it?

At the moment I have another hard drive which stores my important data, so that if ever did mess up I would not lose these files. However having /home here would also be a massive advantage as when I next upgrade or reinstall my settings would be in place already by the sound of it?

If I was to re-install my system from scratch for simplistic sake. How would I tell Ubuntu to install the system at “/” of drive A and /home on Disk B?

You’ve sold the idea to me, but not told me how I would go about it? Does the Ubuntu install process recognise that I already have a /home on another drive? Or is this something I reconfigure afterwards?

nice article. Just share a little my experience :). i prefer to set up /usr/local instead of /usr. i likes to compile some programs by myself. /usr/local is a safe place will be keep intact during system upgrade. another partition is /srv (mainly for server) i was wandering for sometime between /srv and /var. a lot of admins choose /var, i think /srv is suitable for me as it spells “service”, which matches server’s functions. so i put “ftp”, “www”, “svn”, etc. inside. sometimes i also use LVM. I can’t always be sure how big the partition size is. So i put those uncertain partitions into a LVM partition, in which LV can be changed in a later time.

FWIW, LVM is the solution to being able to re-size and re-configure your partitioning after the fact. This does require the forethought of making the partitions LVM in the first place. (And note that LVM won’t work for /boot.)

@Ade

You have a backup system in place, right? You can create a new partition on the 2nd drive, restore your backed-up /home, and then delete the original. It’ll be a good test of your backup system — you do want to know that it works _before_ it’s too late.

I agree with tim in regards to /usr/local. It is the default location for unmanaged (not controlled by a package manager) applications. Many closed source games go in there and they can be quite large with mods and other add-ons. The /opt directory is another one with similar usage.

If you ever install a debugging version of a kernel then you will need more space in /boot. I normally use 250MB as with 100MB I ran out of space during kernel updates on Ubuntu because I had a debug kernel installed to aid in reporting kernel bugs.

A separate /boot partition is also required with dm-crypt as the computer has to load the kernel from an unencrypted partition in order to access the encrypted volumes.

LVM is helpful but when you increase a logical partition you still need to resize the filesystem within it in order to make use of the space.

The problem with having a separate /home partition arises when you have several Linux distros on the system. /home/username contsins various desktop environment and user program configuration files. If different versions are used by different distros, the latest installed version will be accessed.

I generally use /home as part of the / partition, but with user data files in another partition mounted during boot on /home/username/whatever with programs configured to use this for their data files and /home/username for their user config files.

As I have had issues with config file version differences, I can see the reasoning behind that approach. Often if I know I’m moving to a distro with major differences in design or package versions I’ll do something similar to what you suggest and leave the home in / but keep the old files mounted elsewhere.

Another option when using a separate /home with multiple distros is to have different usernames on each distro. This will prevent the config files from being affected. I routinely keep data files on a separate partition, this is something I did even before being introduced to linux.

For multi boot or multi distro, sharing /home or /boot partition is tricky! It’s much easier to make a Data partition mounted under /mnt, and a Main Bootloader partition, which can present a unified main boot menu pointing to each individual distro/OS’s bootloader inside their OS partition… check out http://ubuntuforums.org/showthread.php?p=7343886

Think the comments about Windows are not true anymore if they ever were true (I installed Win98 SE into a partition I built with Debian for example once). Very many OEM installs have utility or recovery partitions installed before Windows. Personally Installed Win7 into a logical partition without bother. Those comments about “wiping” things out, probably concern boot loader; Windows does seem to like being in active partition for Suspend RAM & Hibernate. Never had any bother using GRUB as main boot loader on 2nd disk.

To second jhansonxi's comment on the size of /boot, over the lifetime of an LTS (3-5 years) the various kernel updates alone tend to fill up 200-300 megs, so while (half) a gig may look somewhat oversized now, I had come to regret smaller /boot partitions when I couldn't physically access the machine to clean them up later on.

Moreover, in an age of D(igital)TV, /var has to hold the video recordings from a VDR (cf. MythTV in the U.S.) which require up to 2 gigabytes per hour even in Standard Definition (let alone FullHD), as well as various temporary files while mastering DVDs etc., print and (unless in /home) mail spools, many of which tend to grow and should survive the transition to the next release of your OS a few years down the line.