Linux Disk Partitioning

Theory

There are three times as many different partitioning schemes as there are engineers to ask about them. This is the one used by The Anvil Organisation for all machines from laptops to mainframes. The reasons for using separate filesystems hold true whatever size of computer you are talking about so why should the scheme vary. The anvil.org scheme is based on dividing up the data on a machine into 3 distinct blocks. The first is the boot/root filesystem. This is the combination of the root filesystem and the /boot directory that used to be traditionally divided off to a separate, low partition number, partition. This block is very useful indeed if the machine needs to be rescued. It would make life so very much easier of this one survived the machine failure. The second is the rest of the generic parts of the operating system. It includes such notables as /var, /usr, /tmp & swap. The last is the data load on the system, such as /home or /export.

Root Filesystem

In the good old days the PC BIOS could not read the hard drive beyond around 1000 cylinders. This meant that any part of the OS that was needed for the section of the boot sequence before the kernel startup, had to be tucked in to the beginning of the disk. The trick was to create a 100M partition very early on the disk, if not first, and make this the /boot filesystem. More recently, the BIOS can be directed to read the whole disk, there is no longer any need for a separate /boot partition. This tutorial advises the reader to combine the /boot and the root filesystems together.

As noted above, the root filesystem is extremely useful to have around if you need to recover the machine. For this reason we need to ensure it's survival. It would be good advice not to make the root system a logical volume, the whole volume group has to have survived in order to mount the root filesystem. The system adopted by anvil.org is to have this filesystem as a mirror of about 1Gbyte. If there is only one drive then a partition of 1Gbyte will do the trick, but if it was a single sided mirror it would allow a much easier ride in the event of a disk starting to fail.

vgsystem

The operating system can take anything up to 10Gbytes of space. Usually it takes much less than this, but if you have a disk system in the order of 100s of Gbytes it could be argued that losing 10Gbytes is no disaster. The easiest way of keeping the OS filesystems in trim is to make them all logical volumes taken out of the same volume group. The volume group should be one made of mirrored physical volumes if possible. They can of course be RAID5 volumes, but the redundancy is less complete with RAID5 and it's ability to survive a system event is much lower than with RAID1 mirroring.

vgdata

Finally the data, the part of the overall dataset, outside of OS settings, that makes this machine unique. This might very well be orders of magnitude bigger than the root filesystem and vgsystem volume group put together. This can be provided using whatever disk provisioning technique is deemed appropriate, but anvil.org will again generally use RAID1 mirroring.

Which filesystem in what volume group


Filesystem
/dev/md0
vgsystem volume group
vgdata volume group
root
X


/usr

X

/var

X

/tmp

X

swap

X

/opt

X

/var/spool/mail


X
/export/marketing


X
/home


X

Summary

Partition numbers on first two disks:
  1. The boot/root filesystem at 1Gbyte
  2. The vgsystem volume group at 10Gbytes
  3. The rest of the disk as the vgdata filesystem
Further disks would be very usefully employed as single partition drives, mirrored and given over to the vgdata volume group.

Examples

Single 100G SATA disk drive

/dev/sda1 = 1Gbyte => root filesystem
/dev/sda2 = 10Gbyte => vgsystem volume group
/dev/sda3 = 89Gbyte => vgdata volume group

Dual mirrored 100G SATA disk drives

/dev/sda1 = 1Gbyte => /dev/md0 => root filesystem
/dev/sda2 = 10Gbyte => /dev/md1 => vgsystem volume group
/dev/sda3 = 89Gbyte => /dev/md2 => vgdata volume group
/dev/sdb1 = 1Gbyte => /dev/md0 => root filesystem
/dev/sdb2 = 10Gbyte => /dev/md1 => vgsystem volume group
/dev/sdb3 = 89Gbyte => /dev/md2 => vgdata volume group

Quad mirrored 100G SATA disk drives

/dev/sda1 = 1Gbyte => /dev/md0 => root filesystem
/dev/sda2 = 10Gbyte => /dev/md1 => vgsystem volume group
/dev/sda3 = 89Gbyte => /dev/md2 => vgdata volume group
/dev/sdb1 = 1Gbyte => /dev/md0 => root filesystem
/dev/sdb2 = 10Gbyte => /dev/md1 => vgsystem volume group
/dev/sdb3 = 89Gbyte => /dev/md2 => vgdata volume group
/dev/sdc1 = 100Gbyte => /dev/md3 => vgdata volume group
/dev/sdd1 = 100Gbyte => /dev/md3 => vgdata volume group



Author: Andrew Meredith <andrew@anvil.org>
Date: 27th March 2007
Copyright: The Anvil Organisation Ltd 2007

This document is released under the GNU Free Documentation License.

Valid HTML 4.01!

Andrew Meredith  <andrew@anvil.org>
Last modified: Tuesday, 27-Mar-2007 16:08:37 BST

fedora.redhat.com httpd.apache.org www.cacert.org

Valid CSS!