How to create Logical Volume

To create a LVM, run

lvcreate -L 3T -n backup vg1

This command will create a logical volume with 3 TB size with name backup inside volume group vg1.

To format it as xfs file system, run

mkfs.xfs /dev/vg1/backup

To mount it, add the following line in /etc/fstab file.

/dev/vg1/backup /backup  xfs defaults 0 0

Create LVM using all available disk space

Create a LVM using all available disk space in Volume Group vg1

root@ok:~# lvcreate --extents 100%FREE vg1 -n data1
  Logical volume "data1" created.
root@ok:~# lvs
  LV    VG  Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  data1 vg1 -wi-a----- 58.10t                                                    
root@ok:~# 
lvcreate --size 100G --type thin-pool --thinpool LV_NAME_HERE VG_NAME_HERE

example

[root@server ~]# lvcreate --size 100G --type thin-pool --thinpool thin_pool vg-storage
  Thin pool volume with chunk size 64.00 KiB can address at most 15.81 TiB of data.
  Logical volume "thin_pool" created.
[root@server ~]#

To remove the volume created, run

[root@server ~]# lvremove vg-storage/thin_pool
Do you really want to remove active logical volume vg-storage/thin_pool? [y/n]: y
  Logical volume "thin_pool" successfully removed
[root@server ~]#

See lvm

Need help with Linux Server or WordPress? We can help!

Leave a Reply

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