Linux partition creation guide


My favourite FS

This is a subjective question, and I can't give anything more than a subjective answer. The answer I have for all filesystem problems is XFS. I've been using SGI's XFS filesystems ranging from x86, ppc, and even DEC Alpha running Linux. It's quicker than the rest, and it's journalled. For me, it is the filesystem of choice. You may disagree, please don't mail me complaning about it! If you disagree, then simply use another filesystem.

Why create many seperate partitions?

A Unix filesystem has some specific componets. For instance /var is accessed more often and modified than say, /usr. So, pretty much, indpedant of which filesystem you use (ext3, xfs, jfs, reiserfs etc), you will still experience external fragmentation. This will inevitably make things slow if you simply have one large monolythic filesystem. This effect is something that I have observed, even in the machines of today.

Elegance with the x86 partition map

One can argue that the x86 partition map is the ugliest of them all (except some Unix partition slices are pretty ugly). With the x86 partition map, there can exist only 4 primary partition. Newer versions of MS operating systems do not even support more than one primary partition. By default, they create an extended partition and put logical volumes into there. With Linux fdisk, you can fine tune everything.

When installing Linux on a machine, two different scenarios that can arise. First is the trivial one - dual boot. Here, you need to neccessarily make the Windoze partition hda1 and create an extended partition hda2. You can embed all other Linux/Windoze under this extended partition. The second less obvious approach is when you have a dedicated Linux system. There are two ways in which you can structure this type of partition. Most people would take the naieve approach and create a Linux partition (primary) in hda1 and an extended hda2. In my view, the elegant approach is to make hda1 the extended partition (With newer bios', you can make a extended partition the active one, and the Bios will still load the Bootloader).  This way, you can create as many partitions as you like, and they will all be logical volumes.

My approach to a healthy fstab

Generally, I use separate partitions for /, /var, /usr, /home. This way, fragmenting /var will not cause a slow down of accessing data in /usr. Likewise, one can expect /home to be accessed and modified more often. In essence, you really want to protect /usr from being fragmented, because most of the program code is often stored there. However, if you have a small disk, then it's excusable to only have two seperate physical partitions - / and /usr. If you're a kernel freak, and do lots of kernel compilation (or compilation in general in /usr/src) then I would make /usr/src a seperate partition. Otherwise, you're going to end up with fragmentation in /usr.

Guide to file system sizes

It all depends on what you do, and which distribution you use. Here, I will talk about the sort of space I've allocated for my Debian systems. Generally, I allocate:
You can take this in proportion to the space I've used, and then reduce the sizes proportionally. That should work. Under Debian, we need lots of space for /var because thats where apt caches its package downloads. I find that for my setup, 700MB is extremely sufficient.

Keeping your filesystems healthy

You need to make sure that your filesystems stay healthy. In my opinion, under a Unixy system, the most important thing is that you don't make access to your program code as fast as possible. So, don't pollute /usr. Anything that you think is going to cause heavy modification of files will probably cause external fragmentation no matter how hard your filesystem tries to avoid it (XFS does it well with access lists). So, seperate anything of the sort to a different partition.

Back | Home