- Posted In
- Red Hat Enterprise Linux
Determine disk type for clearpart on kickstarts
I would like to develop logic in my kickstart to determine whether or not there is an sda or nvme0n1 drive and then clearpart that disk. So far, I have tried the solutions here:
But, they fail saying the drive cannot be located (it is an sda drive on my test machine). I have also tried just using the command "clearpart --drives=sda,nvme0n1 --Linux" and it fails saying it could not locate the drive.
Any assistance is appreciated. I am using RHEL 6.9, Satellite 5.7.
I would have taken the approach used in your first link to generate a kickstart snippet in %pre and the include it in the later part of the kickstart.
Which part of this logic didn't work in your scenario?
The error I get is "Specified nonexistent disk in clearpart command."
The relevant portion of the kickstart is here:
I got it working by adjusting the parameters for which it was searching for drives. Updated code:
This is a great idea for identifying dynamically the boot disk device, be it NVME or SATA/SAS!
I've made some simplifying changes below, and also added a check if ROOTDRIVE is undefined. I'm assuming that NVME boot drives will be preferred over /dev/sd* drives, YMMV.
I introduced a MAXSIZE as well because we do not want to clobber any large data-disks! Also the partitioning details may be defined differently.