Add LVM Storage as Directory in Proxmox

by RamWise
Published: Last Updated on 23.9K views

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 

6. On the logical volume create a File System for usage. I am creating an ext4 file system on it.

mkfs.ext4 /dev/vgrp/lvol 

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.


Chris G December 22, 2021 - 1:04 pm

thank you for your help!

Vmware to Proxmox: The ultimate guide to convert a VM in 5 easy steps April 21, 2022 - 12:19 pm

[…] this article, I won’t tell you how to configure LVM. I recommend this blog to configure local storage as a repository for your […]

Cleverson July 22, 2022 - 11:29 pm

Obrigado por compartilhar conhecimento.

Neil O'Connell November 12, 2022 - 8:18 am

I have been struggling with this for a while now. Thank you. Clear, concise and direct. And it worked. Well done.

Pete January 7, 2023 - 1:36 pm

Thank you, this was excellent!


Leave a Comment

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More