Before starting on the main install its worth talking about the layout of the drives in a server build. A linux install will create several partitions when it is installed. It will create a boot partition of around 100Mb, a swap partition of a couple of gigs (well, around the size of the amount of RAM you have) and a data partition for everything else. This can certainly be done on one drive, but it probably worth making the distinction between user data and OS data as well. If you use two drives you can put the operating system onto a laptop drive or SSD drive, and the data onto a seperate drive. This has a couple of advanages:
- The high power data drive can spin down when not in use (there are some gotchas here – we’ll come to them later)
- The system drive can be rebuilt without messing with your data.
Linux tends to have its user data in two places. Firstly /home – contains all the user directories. Secondly /var – things that you install onto the system software wise. Even with one drive it is probably worth considering mounting /home onto a seperate partition – this way you can rebuild the OS with no impact to user data. /var is slightly trickier – I tend to simply point things that I want to keep seperate (apache web root, mysql databases) at functional user areas in /home instead and leave /var itself on the main partition.
On top of this CentOS has one extra complication – the filesystem is built using LVM. LVM stands for logical volume management, and is a way of getting round the issues that partition based setup may create. Say for example that you created a home partition for /home and you gave it 100Gb. Then it filled up. If you buy a new hard disk you have to create a new partition, copy the data round, remount the new partition and so on. LVM provides a way of abstracting the partions from the disk. LVM is structured into tiers:
- The physical volumes – these represent the hard drives in your system
- volume groups – a grouping of logical volumes and physical volumes
- logical volumes – the equivalent of partitions – so where you actually put your data.
So say you have 2 1Tb hard disks. With LVM you create 2 1Tb phyisical volumes, which you group into 1 volume group. The volume group has 2Tb of space available to it, which you can then break up into as many logical volumes as you want. The great thing about this is that if you create a /home logical volume and its not big enough you have options. You can shrink one of the other logical volumes and re-assign the space to your home area. Or you can add another disk, put its space into the volume group, and then assign that space to the home logical volume. In short your logical volumes can span multiple disks, and be resized at will. So a bit more complexity, but a lot more flexibility. There’s lots more info on the LVM FAQ if you want to know more.
In order to avoid as much confusion as possible when doing the base install onto the server the easiest thing to do is only have the system drive plugged in.