Using parted command to create LVM partitions
Oracle Linux 6.6
To create Physical Volumes for Volume groups (LVM) , the disk need to be partitioned to LVM type ie. 'Linux LVM' type . In fdisk , this can done by choosing 8e when prompted for partition type. Since it is easy to script (non-interactive), I use parted command rather than fdisk to create partitions For creating standard partitions, I use the below 2 non-interactive steps in our scripts Step1. Creating the partition table for the device parted -s /dev/sda mklabel msdos For gpt, I use parted -s /dev/sda mklabel gpt Step2. create a primary partition that starts after 1mb (to ensure proper alignement) parted -s /dev/sda unit mib mkpart primary 1 100% From the below link , I gathered that partition can be set to LVM type interactively using set [partition number] lvm on http://computernetworkingnotes.com/p...-in-linux.html But, how can I incorporate this into step2 (non-interactive) shown above ? How to create LVM Partition in Linux |
Why not a step 3 ?.
And more to the point, why are you using a partition at all ?. Simply run pvcreate against the device node - no partition needed. Save you all that apparent angst. |
Quote:
You can use: Code:
parted -s /dev/sda set 1 lvm on |
All times are GMT -5. The time now is 11:13 PM. |