Adding Disk to Centos LVM

While you can just create a pv out of raw block device I normally try to avoid it as it can cause confusion as to what the block device is being used for. It may also break some of the auto discover routines that LVM can use if it’s missing it’s configuration files.

Here’s an example of using parted to create a GPT with 1 partition that is the whole drive and set the partition flag to be lvm. The mkpart requires that you specify a file system but it doesn’t create the file system. Seems to be a long standing bug in parted. Also the start offset of 1M is to ensure that you get proper alignment.

parted /dev/sdb
mklabel GPT
mkpart primary ext2 1M 100%
set 1 lvm on
pvcreate /dev/sdb1
vgcreate vg_*name* /dev/sdb1 /dev/sdc1 /dev/sdd1
lvcreate –extents 100%FREE -n lv_*name* vg_*name*
mkfs.xfs -f /dev/mapper/vg_*name*-lv_*name*
df -ah

Leave a Reply

Your email address will not be published. Required fields are marked *