LVM is an abstract software layer on physical hard drives. It provides an easier, and flexible storage management by creating logical volumes. Proxmox VE supports LVM backend for VM and container storage. This tutorial will help you to create an LVM volume with multiple drives, and add it as a directory in Proxmox VE.
If you would like to start by installing Proxmox VE instead go to my post here. You can continue back here to create an LVM as a directory in Proxmox after that.
1. Install the hard disks and check if they are visible under Disks. I have two drives which are going to be used for the LVM.
2. To prepare the disks for LVM creation, first wipe them.
wipefs -a /dev/sdb /dev/sdc
3. Create physical volumes on the disks using pvcreate. Physical volumes are the basic blocks of LVM storage.
pvcreate /dev/sdb /dev/sdc
4. Next create a volume group with all the disks. Volume group will combine all physical volumes to give one central storage structure.
vgcreate vgrp /dev/sdb /dev/sdc #vgrp is the name of the vol group
5. Now we are ready to create the logical volume on the volume group. I am creating one with 18.00 TB space.
lvcreate -L 18.0T -n lvol vgrp #lvol is the name for the logical volume
7. File system is set up, so we can mount it under a directory.
#Create a mount point mkdir -p /mnt/lvol #Mount the volume mount /dev/vgrp/lvol /mnt/lvol #Add it to /etc/fstab for automount: echo "/dev/vgrp/lvol /mnt/lvol ext4 defaults 0 2" >> /etc/fstab
8. Go to PVE web interface. Under Disks -> LVM you should see the volume group ‘vgrp’.
9. Under Datacenter -> Storage. Add a Directory with a unique ID and the mount point we created in step 7, as below. This will allow Proxmox recognize it as a storage for its contents.
All set. You can now use this directory for any storage(Backup, Disk Image, Containers, ISO, etc.), meanwhile managing it easily via Linux LVM manager.