The lvcreate command can be used to create an LVM logical volume. In this example, a 1 GB logical volume named myLV is created from space in the volume group named myVG. This assumes that a volume group named myVG has been created.
~]# lvcreate --size 1G --name myLV myVG
Or, the --extents option can be used. Refer to what are LVM extents to understand what LVM extents are.
~]# lvcreate --extents 50%FREE --name myLV myVG
The lvdisplay command can be used to verify the logical volume has been created.
~]# lvdisplay ---Logical volume--- LV Path /dev/myVG/myLV LV Name myLV VG Name myVG LV UUID EuBJ3c-Q8EU0M5ef-Qvip-KeyH-m2Sc-MGelKe LV Creation host,time localhost.localdomain, 2013-10-11 15:40:12 -0500 LV Status available # open 1 LV Size 99.94 GiB Current LE 3198 Segments 3 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:9
Next, the mkfs command can be used to create a file system on myLV. In this example, the ext4 file system is created on myLV.
~]# mkfs.ext4 /dev/myVG/myLV
Now, myLV can be mounted. In this example, myLV is mounted to the /var directory.
~]# mount.ext4 /dev/myVG/myLV /var