Find the new physical volume using fdisk -l
. Let's say it is /dev/sda
.
Then partition using fdisk /dev/sda
. Type n
to create primary partition, default partition 1, default sectors.
Then type t
to change partition type to 8e
(Linux LVM). Then type w
to write the partition table.
pvcreate /dev/sda1
Now you can see the new physical volume using pvs
and pvdisplay
.
Let's say the new volume group is vg_name
. Then do
vgcreate vg_name /dev/sda1
Now you can see the new volume group using vgs
and vgdisplay
.
Let's say the new logical volume is lv_name
.
To specify the size in absolute terms use the -L
flag:
lvcreate -L 100G -n lv_name vg_name
To specify the size as a percentage of the volume group use the -l
flag:
lvcreate -l 100%FREE -n lv_name vg_name
Now you can see the new logical volume using lvs
and lvdisplay
. In particular the latter will show you that the new logical volume has a path something like /dev/vg_name/lv_name
.
Use for example
mkfs.ext4 /dev/vg_name/lv_name
and then
mount /dev/vg_name/lv_name /mount/point