||10-13-2012 07:20 PM
Issues creating partitions in %pre script
I have an automated CentOS install controlled through kickstart and I need to create my partitions in the %pre script using parted. I have code something like this:
dd if=/dev/zero of=/dev/vda bs=1M count=1
parted -s /dev/vda mklabel gpt
parted -s /dev/vda mkpart primary ext4 0 128
parted -s /dev/vda mkpart primary linux-swap 128 2G
parted -s /dev/vda -- mkpart primary ext4 2G -1
This is straightforward enough, unfortunately it doesn't work quite right. Even though I create the partitions, they don't all exist in fact when the parted steps are done. Partition vda1 exists and the mkfs works as expected, however, vda3 isn't recognized by the system, and therefore the mkfs for that partition fails.
Logs I've captured shows the following errors:
00:00:59,708 INFO : Warning: The resulting partition is not properly aligned for best performance.
00:00:59,775 INFO : Warning: The resulting partition is not properly aligned for best performance.
00:00:59,848 INFO : Warning: WARNING: the kernel failed to re-read the partit/var/log/anaconda.program.log
ion table on /dev/vda (Device or resource busy). As a result, it may not reflect all of your changes until after reboot.
00:00:59,947 INFO : Warning: WARNING: the kernel failed to re-read the partition table on /dev/vda (Device or resource busy). As a result, it may not reflect all of your changes until after reboot.
Clearly I cannot reboot in this case since I'm in the middle of an install. How can I force the partitions that I create with parted to be present and available in the subsequent format step?