LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Virtualization and Cloud (http://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/)
-   -   Issues creating partitions in %pre script (http://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/issues-creating-partitions-in-pre-script-4175432091/)

PeterSteele 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:

Code:

%pre
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
mkfs.ext4 /dev/vda1
mkfs.ext4 /dev/vda3
%end

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:
Quote:

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?

kumarat9pm 10-14-2012 11:13 PM

This can be solved by using partx -a /dev/sda
 
Hi please have a look at below link.

http://thelinuxerrors.blogspot.com/2...ion-table.html


All times are GMT -5. The time now is 05:15 PM.