[CentOS] Kickstart putting /boot on sda2 (anaconda partition enumeration)?

Bryce Evans

bryceevans at gmail.com
Wed Apr 3 19:01:29 UTC 2019


Does anyone know how anaconda partitioning enumerates disk partitions when
specified in kickstart? I quickly browsed through the anaconda installer
source on github but didn't see the relevant bits.

I'm using the centOS 6.10 anaconda installer.

Somehow I am ending up with my swap partition on sda1, /boot on sda2, and
root on sda3. for $REASONS I want /boot to be the partition #1 (sda1)

My kickstart storage config looks like this:

bootloader --location=mbr --driveorder=sda,sdb
zerombr
ignoredisk --only-use=sda,sdb
clearpart --all --drives=sda,sdb
part raid.boot0 --size 1000 --ondrive=sda
part raid.swap0 --size 8192 --ondrive=sda
part raid.root0 --size 8000 --grow --ondrive=sda
part raid.boot1 --size 1000 --ondrive=sdb
part raid.swap1 --size 8192 --ondrive=sdb
part raid.root1 --size 8000 --grow --ondrive=sdb
raid /boot --fstype ext4 --device md0 --level=RAID1 raid.boot1 raid.boot0
raid swap --fstype swap --device md1 --level=RAID1 raid.swap1 raid.swap0
raid / --fstype ext4 --device md2 --level=RAID1 raid.root1 raid.root0

The anaconda-ks.cfg file that gets written out to /root (after kickstart
finishes) looks like this:

#zerombr
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
#clearpart --all --drives=sda,sdb
#ignoredisk --only-use=sda,sdb
#raid /boot --fstype=ext4 --level=1 --device=md0 raid.008018 raid.008002
#raid swap --level=1 --device=md1 raid.008017 raid.008001
#raid / --fstype=ext4 --level=1 --device=md2 raid.008019 raid.008003

#part raid.008001 --size=8192
#part raid.008002 --size=1000
#part raid.008003 --grow --size=8000

#part raid.008017 --size=8192
#part raid.008018 --size=1000
#part raid.008019 --grow --size=8000

I'm assuming that my swap is being put on sda1 because for some reason that
partition gets the lowest numeric value in the name (raid.008001) But I
don't see why that is happening, nor am I sure how to tell anaconda that I
want /boot on the first partition (other than doing it in %pre)

I cannot specify the 'onpart=sda1' option because I use 'clearpart' in the
script, and according to the docs:
"If the clearpart command is used, then the --onpart command cannot be used
on a logical partition."

The partition table on disk ends up looking as such:
bash-4.1# parted /dev/sda
GNU Parted 2.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Model: HP LOGICAL VOLUME (scsi)
Disk /dev/sda: 480GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  8591MB  8590MB  primary               raid
 2      8591MB  9640MB  1049MB  primary  ext4         boot, raid
 3      9640MB  480GB   470GB   primary               raid



Anyone know where I should be looking, or have a workaround besides doing
my partitioning in %pre?

Thanks


More information about the CentOS mailing list