LVM volumes on Proxmox VE
Today I'm going to introduce you to LVM volumes and how to add a thin provisioned volume to store your containers and virtual machines on Proxmox VE.
Contents:
- 1-What's LVM?
- 2-Creating a volume group
- 3-Creating a storage pool
- 4-Adding LVM-Thin to PVE
1-What's LVM?
An LVM (Logical Volume Manager) lets you create and manage logical volumes.
Think of these as virtual disks, an abstraction of physical disks.
Among other things, you can:
- Create multiple volumes within a storage pool
- Format these volumes in different formats
- Reduce or enlarge them without reformatting
- Add physical disks to the storage pool
For further information.
2-Creating a volume group
In this tutorial, I'm going to set up an LVM-Thin (Thin Provisioning) storage pool.
The advantage of LVM-Thin is that it allocates disk space in small quantities so, for example, instead of monopolizing 50 GB for a virtual machine's disk, the disk will reflect its actual size at time T (only the files written, not the final size).
Let's take a concrete example. I have a Dell Optiplex 7020 SFF (16 GB RAM, Xeon E3-1265l v3) with 3 disks:
- sda: a 128 GB SSD, which is the main Proxmox VE drive
- sdb: an 8TB hard disk which I use to store static data (videos, music, games etc.)
- nvme0n1: the 480 GB NVME I've connected to the PC's PCIE port.
If I type the command "lsblk", I find all 3 disks.
I need this NVME to be able to store my containers and virtual machines, as well as to gain in performance when launching several simultaneously, as the PCIE port has a higher throughput than the SATA port.
So I'm going to create a volume group named "vg_thin", targeting the NVME located in /dev/nvme0n1".
vgcreate -s 32M vg_thin /dev/nvme0n1
If I type in the "vgs" command, I find the "vg_thin" group in the list in addition to the "pve" group I created when I installed the PVE server.
vgs
3-Creating the storage pool
Finally, I need to create a thin provisioning pool, which I'll call "homelab_pool".
It will monopolize the entire NVME and will be used to store containers as well as virtual machines.
lvcreate -L 465G --thinpool homelab_pool vg_thin
So I created
- A volume group named "vg_thin"
- A storage pool named "homelab_pool"
In another case, I could have :
- Create two or three storage pools (150 GB each, 450 GB total)
- Create volumes in these pools
- Mount and format them in any format I wanted
But that's not the point of this tutorial, and PVE only recognizes volume groups (LVM) and storage pools (LVM-Thin) for storing virtual machines and containers.
4-Add LVM-Thin to PVE
Go to DatacenterStorageLVM-Thin.
- ID: give your LVM-Thin a name
- Volume group: the "vg_thin" group I created earlier
- Thin Pool: the "homelab_pool" pool I've also created
Great!!!! LVM-Thin appears as storage space.
If you like my contents, follow me on:
- Discord: https://discord.gg/nhQzEDSx7x
- Instagram: https://www.instagram.com/technonagib/
- Reddit: https://www.reddit.com/r/technonagib/
- Twitter: https://twitter.com/technonagib