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

Thu Apr 4 08:46:52 UTC 2019
Gianluca Cecchi <gianluca.cecchi at gmail.com>

On Wed, Apr 3, 2019 at 9:02 PM Bryce Evans <bryceevans at gmail.com> wrote:

> 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

> 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
You write about "--onpart" not feasible due to logical partiitons, but it
seems you end up with 3 primary partitions?
Anyway, you could try something like this that I use (not with raid but it
could work) and in your case would be

part raid.boot0 --size 1000 --asprimary --ondisk sda
part raid.swap0 --size 8192 --asprimary --ondisk sda

(--ondisk and --ondrive should be equivalent... also in CentOS 7)
In my case both in CentOS 5 and 6 it always created the first specified on
sda1 and the second one on sda2