CentOS and Disk Partitioning

I still wanted to build a CentOS test system. At work CentOS is used in containers and on some bare metal systems. The bare metal systems all use hardware RAID controllers. A test system would be useful.

The test machine is nothing special. No hardware RAID controller and a basic off-the-shelf motherboard with two hard drives. As I have no experience with Linux software RAID, I thought that would be a nice exercise with this test machine.

Except that the Anaconda installer is not exactly user-friendly. Specifically the section for configuring the disk partition layout. Browsing the web indicates more than a few people disgruntled with the design.

I wanted the following partition layout:

    / system partition
    swap partition
    /nfs partition

No separate /boot or /home partitions. On the existing bare metal systems at work, we use the /nfs mapping for backups from other systems.

Creating partitions with the installer is a nightmare.

I practiced in a virtual machine (VM). First with a single disk.

The Red Hat folks are obsessed with LVM. While LVM is not harmful with simpler systems, not using LVM removes a layer of complexity.

The LVM default can be overridden in the installer. I created an sda1 system partition and an sda2 swap. When I created the third partition I could only choose mount points from a fixed list. I chose /home and after creating I renamed to /nfs. The installer immediately changed the partition layout order. The renamed /nfs partition became sda1 and the system partition sda2. No, really.

I wiped the layout and started fresh. Of course, like the neighborhood dog that never stops barking, the installer defaults to LVM. Change to Standard Partition. The installer defaults to xfs. Change to ext4. This time I chose /var as the third partition and as before, the installer left things alone. I renamed the /var partition to /nfs. Once again the installer changed the partition order.

I tried several times, each time trying to modify my approach. Every time the installer insisted on changing the partition order.

In the end I did not care to waste any more time. I used a Live ISO and manually created the partition layout that I wanted. This works well except for another caveat. The Anaconda installer will not allow using existing partitions unless the Reformat option is selected — even when the partitions are empty and already formatted.

Thereafter I installed CentOS using the existing partition scheme.

I used the minimal install ISO. The system boots to a command prompt, but of course, the default installation uses a boot splash. Bewildering why everybody is so afraid of seeing the boot output.

The next step was adding a second drive to use RAID 1.

I wanted the same partition layout but modified for RAID 1:

    / system partition (sda1/sdb1 - md0)
    swap partition (sda2/sdb2 - md1)
    /nfs partition (sda3/sdb3 - md2)

Because of this narrow focus with LVM, the installer insists on creating a separate /boot partition. This causes a peculiar partition layout with RAID 1. The /boot partition is created on disk 1 and then the mirrored partitions are duplicated to both drives. For example, the system root partition (/) will be mirrored across the two disks on partition sda2 and sdb1. While functional, this looks weird. Further, when not using LVM I see no need for a separate /boot partition.

I again tried using the Anaconda installer. Same futile results. I again created my desired partition layout with a live ISO.

I used the following steps to create the array:

  • Use cfdisk /dev/sdato create three partitions of Type FD.
  • Make the first partition (/) Bootable.
  • Use sfdisk to copy the partition layout to sdb.
  • Create the array.
    sfdisk -d /dev/sda | sfdisk -f /dev/sdb
    mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1 --metadata=.9
    mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sda2 /dev/sdb2 --metadata=.9
    mdadm --create /dev/md2 --level=1 --raid-devices=2 /dev/sda3 /dev/sdb3 --metadata=.9
    mkswap /dev/md1
    cat /proc/mdstat
    mdadm --detail --scan

Then use the Anaconda installer. At least the installer recognized the array partitions and created /etc/mdadm.conf.

I repeated the steps in a small bare metal system. Configuring the partition scheme outside the Anaconda installer seems to be the only sane approach. In the end, a stress free approach is just avoid non Red Hat partition layouts using Anaconda. Configure the layout before running the CentOS install disk.

Perhaps there is a way to manipulate the installer to create the desired partition layout. Perhaps not. The installer is a good example of developers trying to out think and out smart what users want or need rather than provide a simple design of letting users decide. Phrases like WTF and POS come to mind. The installer deserves every cynical opinion voiced on the web.

I accept that CentOS is popular in the server space. That LVM is standard and sane in servers. Just understand the design of the installer, which is, don’t dare think outside the Red Hat box.

Posted: Category: Usability Tagged: CentOS

Next: How to Waste the Day (Again)

Previous: One Chance to Make a First Impression