[SOLVED] Shrinking of lvm-thin possible? Best workaround?

larsen

Active Member
Feb 28, 2020
155
15
38
Hello,

as far as I understand from other threads (https://forum.proxmox.com/threads/resizing-pve-data.30506/ and https://forum.proxmox.com/threads/reduce-local-lvm-pve-data-and-extend-root.48499/), it is not possible to shrink a lvm-thin volume. As those threads are quite old, I wonder if this restriction still applies...?

Automatic setup has made the LV "root" ~100 GB and the LV "data" ~7 TB. I need more space for backups, so I (think) I'll have to shrink data and grow "root" or create a LV "backup". In case that restriction still applies, I would have to move all VMs to another server (the old one that should be decommissioned and has been removed from the cluster already), delete lvm-thin, and re-create it with a smaller size.

Is there a better way?


Lars
 
If you still have space in data you can create a thin-volume in the data pool and create a filesystem on that - add it to fstab (or preferably create a 'mount-unit' - see `man systemd.mount) and then add the mount point as directory storage (with type backup) to your storage configuration

I hope this helps!
 
I have now created the thin-volume and it's mounted via systemd, but when I want to "Create: Directory" I get "No Disks unused".
 
The 'Disks' panel is for formatting new disks only - you need to add the storage definition in GUI->Datacenter->Storage
I hope this helps!
 
Thanks a lot!

For documentation in case anyone else needs this:
Code:
lvcreate -V 1T --thin -n backup pve/data && \
mkdir -p /mnt/backup && \
mkfs.ext4 /dev/pve/backup

cat <<EOF > /etc/systemd/system/mnt-backup.mount
[Unit]
Description=Thin-volume for Proxmox-Backup

[Mount]
What=/dev/pve/backup
Where=/mnt/backup
Type=ext4
Options=defaults

[Install]
WantedBy=multi-user.target
EOF

systemctl enable mnt-backup.mount && \
systemctl start mnt-backup.mount

Proxmox-GUI > Datacenter > Storage > Add: Directory
 
Thanks for explaining your solution!
Please mark the thread as 'SOLVED'
 
Hi,
when I follow the steps described above, I end up with another lvol which is not part of the "data" thin pool. It seems to share the available space with the standard volume "local", not making any space of the "data" lvm-thin-pool available for me.
My Proxmox basically holds data for one single VM only, so the one single physical disk needs to hold Proxmox, the disks of that machine and their backups.
I am well aware that these backups will be gone after a disk failure, as they reside on the very same physical disk. They are just intended for allowing me to roll back to a previous stage of the VM etc.

After installation I ended up with
  • 127 G in a volume group
    • 16 G unused
    • 70 G in a thinpool "data"
      • storing 16 G of machine disks
    • 31 G in a volume "root". Backups currently may be created only here, allowing for 1 backup.
I'd love to user another 35 G for two more backups. How could I accomplish that?

Best regards
Michael
 
I just followed the instructions above, and it worked great -- thank you!

I also got here planning to shrink local-thin and expand local to accommodate for backups, but a much better approach was to create a separate directory for backups inside local-thin, instead of commingling them with OS.

@micgn: are you sure you added the --thin to lvcreate? It should have created the volume inside local-thin. it worked fine here.
 
@micgn: are you sure you added the --thin to lvcreate? It should have created the volume inside local-thin. it worked fine here.

No, I hadn't added it, because I didn't want to have the backup dir within the existing lvm-thin.

However, meanwhile I added a new SSD to the server, re-installed Proxmox from scratch and created a separate EXT4 partition for disk storage and another one for backups. The LVM just holds the root partition with Proxmox itself.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!