Physical Disks Partitioning
Start with 2 disks minimum:
#1 100MB, ID=83 (Linux), Boot Flag ON
#2 Remaining, ID=FD (Linux Raid Auto)
The 100MB partition is for the /boot volume. I leave this on all my drives (even non-boot) to allow for flexibility so any drive can be later enabled to boot. IF the disks are not matched in size, or you have an odd number (500GB, 250GBx2), then divide the partitions of the 500GB drive to match the smaller disks.
RAID
Using the 100MB partitions on sda
and sdb
create a RAID1 (mirror) volume for /boot
. This becomes md0
.
md0 /boot 100MB Ext2
Don't bother using an exotic FS on /boot, it's not worth it.
The remaining space can be set up in different methods. I opt for a RAID10 (mirror/stripe) using 64K chunks and "2 far-copies" for speed. This gives you a lot of flexibility to incrementally upgrade drives down the line. The other options is to do a RAID5/6. However the usable space will be limited to the smallest partition, and DO NOT use partitions from the same devices. Name the new RAID arrays md1
, md2
, and so on.
LVM
Take all of the RAID arrays except md0
, and put them into a single LVM volume group named lvm_vg0
. If you have RAID5 and RAID10 volumes, it's probably best not to combine them, but I guess it wouldn't hurt.
Partition out VG0 for the remaining system mounts. Remember it's relatively easy to add more space if needed, so these numbers can be somewhat conservative.
lvm_vg0-root / 8GB Ext3/ReiserFS (core distro files)
lvm_vg0-home /home 20+GB Ext3/ReiserFS (user data, documents)
lvm_vg0-data /data 60+GB XFS (media, large files, vm's)
XFS file systems cannot be shrunk, so keep that in mind. Also, shrinking an online root volume is probably not supported.
Upgrading
If you ever want to swap disks for larger sizes you have a few options. The easiest is adding drives in pairs or more, and add the new RAID arrays to the current LVM VG.
Another option is adding a single drive that is >= to the sum of the current space. For example, if you have two 100GB device in RAID10, you can add a new 200GB device and mirror it using the two old devices. This is more error prone, but will work.
If needed, md#
devices can be removed from the LVM VG without losing data. This can be done if there is enough free LVM space to shift all used LVM blocks from the md#
device to others. LVM can only use space that has not been assigned to a LV, so an empty file system does not count as "free" space.