0

Using fdisk I create a new partition, write it with 'w', reboot Linux list volumes with lsblk. It shows up fine as /dev/sda3.

But if I do a pvcreate mylvm /dev/sda3

It cant find it. It sayes device not found or ignored by filtering.

I'm trying to get it into my lvm group so that I can extend it using the lvextend command, as my device /dev/sda has more space that I need added to my LVM root.

Please help, Thanks

1 Answer 1

1

pvcreate expects the name of a block device, but above you are giving it two parameters, mylvm (which I presume is a logical volume name) and the block device /dev/sda3.

Create the physical volume

You've said you need to extend your root logical volume, first, you need to create the new physical volume with pvcreate /dev/sda3, pvdisplay will list them.

Add to the volume group

Now, add your new physical volume, /dev/sda3, to your volume group. To find what volume group your root logical volume is using, run lvdisplay and find your root:

$ lvdisplay
  --- Logical volume ---
  LV Path                /dev/vg/root
  LV Name                root
  VG Name                vgdata
  ...

The VG Name line is the name of the volume group in use, so that's what needs to be extended - above the volume group is called vgdata.

Running vgextend vgdata /dev/sda3 will extend the vgdata volume group using your /dev/sda3 physical volume.

Extend the logical volume

Now you need to extend your root logical volume. The LV Path line in the above output gives you the path to your logical volume, in this case it is /dev/vg/root. You just have to call lvextend now:

$ lvextend -L +1G /dev/vg/root

This will extend by 1 GiB. To use all of the free space you added to your volume group, you need to call lvextend with -l +100%FREE which tells it to use all the extents left in the volume group.

$ lvextend -l +100%FREE /dev/vg/root

Resize the filesystem

Finally, you need to grow the filesystem. If using ext2/3/4 run:

$ resize2fs /dev/vg/root

If using xfs run:

$ xfs_growfs /dev/vg/root

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .