
Problem encountered
I had a proxmox server locally running with a disk space of roughly 4TBs. The time came to analyze an unsually large disk image (~1TB). However, by default, when you install a proxmox server, two partitions are created: local and *local-lvm":
local is usually automatically assigned ~90-100GB, and this partition is where the root ("/") is mounted. local-lvm gets all the remaining space left on your server.
local is a regular directory, and thus you can store any files or folders you want there (containers’ and VM’s backup, IS files, etc..). On the other hand, local-lvm is a volume used to efficiently manage and allocate disk space. It is in local-lvm that you will see your lists of VMs and containers (that’s where they are stored). You can’t add files/folders in this partition as you would on “local”.
To create a VM from a backup disk image in promox, you first need to upload it to the proxmos server. However, I had less than 100GB available on the server (and my backup image was ~1TB).
Solution
I had to reduce the space assigned to local-lvm and hand it over to “local”. P.S. This involves recreating local-lvm to a smaller size. Thus, in the process, you will lose all the VMs and containers previously created (since they are all stored on local-lvm).
Steps
Before we dive in, let’s log in to our proxmox server and have a quick look at the space assigned to local and local-lvm:
root@pve1:~# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
data pve twi-aotz-- 4.00t 0.22 10.55
root pve -wi-ao---- <96G
swap pve -wi-ao---- 8.00g
As you can see, my root file system is of size < 96G.
- We need to remove the data volume (local-lvm):
root@pve1:~# lvremove /dev/pve/data
Do you really want to remove active logical volume pve/data? [y/n]: y
Logical volume \"data\" successfully removed
- We can now create a smaller volume for data. Let’s assign 3TB to it (instead of the initial 4TB):
root@pve1:~# lvcreate -L 3000G -n data pve
Logical volume \"data\" created
- We need to convert the created data volume to a thin pool:
root@pve1:~# lvconvert --type thin-pool pve/data
Thin pool volume with chunk size 64.00 KiB can address at most 15.81 TiB of data.
WARNING: Converting pve/data to thin pool\'s data volume with metadata wiping.
THIS WILL DESTROY CONTENT OF LOGICAL VOLUME (filesystem etc.)
Do you really want to convert pve/data? [y/n]: y
Converted pve/data to thin pool.
- We now tell Proxmox to forget about the current local-lvm storage. That’s, we will remove the current local-lvm and add the newly created one:
root@pve1:~# pvesm remove local-lvm
root@pve1:~# pvesm add lvmthin local-lvm -thinpool data -vgname pve -content rootdir, images
There is now more free space in the volume group (which we will use to expand the root filesystem):
root@pve1:~# vgs
VG #PV #LV #SN Attr VSize VFree
pve 1 7 0 wz--n- 4.36T 1.20t
- We may now expand the root file system by 1TB:
root@pve1:~# lvextend -L +1000g /dev/pve/root
Size of logical volume pve/root changed from 96 GiB to 1096 GiB.
Logical volume pve/root successfully resized.
- The filesystem of my root directory was ext. However, since its size was increased, we need to spread that filesystem throughout the newly added space:
root@pve1:~# resize2fs /dev/mapper/pve-root
If yours was XFS instead of ext, you should use this:
root@pve1:~# xfs_growfs /dev/mapper/pve-root
That’s it! You may check the new sizes of the logical volume “data” and the root directory “/root”
root@pve1:~# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
data pve twi-aotz-- 3.00t 0.22 10.55
root pve -wi-ao---- <1.27t
swap pve -wi-ao---- 8.00g