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

Larsen

Well-Known Member
Feb 28, 2020
181
22
58
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.
 
Hello
This thread is one of google's top thread for
"Can't shrink LVM thin pool ?"
And it is marked "SOLVED"
But it contains no solution.

There is an experimental "thin shrink" software (I have not tested)

https://github.com/nkshirsagar/thinpool_shrink

But the answer appears to be, as far as I can tell, that you can only delete and recreate a smaller thin pool, it cannot be shrunk.

More over, as far as I can tell, if you copy thin volumes anywhere else, a thin volume, a image file, your thin volume will become thick.

It is compressible, so you can
Code:
dd thinvolume | tar | xv > file
but the big catch, when you unpack this again to a new thin pool
Code:
xv file | tar |dd > thinvolume

Then your new thinvolume will be of the full thick size, and I don't think there's any way to trim and discard.

So it appears the solution to shrinking a thin pool is ...
take all files out of the volume and save all filesystem metadata (ntfs, ext4 ACL .. etc the whole shebang) into a file & folder storage and then on the new think pool, you will have to reconstruct your filesystems from scratch, format, copy files restore full ACL metadata.

It is not impossible, but it incredibly tedious as, as far as I can tell, no such tool really exist.

And I can tell you because I am in the middle of writing those tools

And here is what basic NTFS metadata looks like for a fresh windows installation of only 129k files & folders.

Code:
2026-08-27  03:33 AM        25,596,049 AllocatedSize.compact.json
2026-08-27  03:33 AM        40,503,855 AllocatedSize.plain.json
2026-08-27  03:33 AM               797 AllocatedSize.summary.txt
2026-08-27  02:56 AM        21,775,539 AlternateDataStreams.compact.json
2026-08-27  02:55 AM        39,931,785 AlternateDataStreams.plain.json
2026-08-27  02:56 AM               825 AlternateDataStreams.summary.txt
2026-08-27  04:39 AM        19,660,656 CaseSensitiveDirectory.compact.json
2026-08-27  04:38 AM        42,750,210 CaseSensitiveDirectory.plain.json
2026-08-27  04:39 AM               829 CaseSensitiveDirectory.summary.txt
2026-08-27  02:36 AM        19,660,525 Compression.compact.json
2026-08-27  02:35 AM        38,355,341 Compression.plain.json
2026-08-27  02:36 AM               785 Compression.summary.txt
2026-08-27  02:22 AM        24,765,864 CreationTime.compact.json
2026-08-27  02:21 AM        58,608,347 CreationTime.plain.json
2026-08-27  02:22 AM               793 CreationTime.summary.txt
2026-08-27  01:55 AM        19,661,871 DaclInheritance.compact.json
2026-08-27  01:55 AM        64,846,652 DaclInheritance.plain.json
2026-08-27  01:55 AM               801 DaclInheritance.summary.txt
2026-08-27  03:25 AM        35,650,431 DosName.compact.json
2026-08-27  03:24 AM        44,328,506 DosName.plain.json
2026-08-27  03:25 AM               773 DosName.summary.txt
2026-08-27  02:46 AM        19,660,279 Encryption.compact.json
2026-08-27  02:45 AM        40,432,572 Encryption.plain.json
2026-08-27  02:46 AM               781 Encryption.summary.txt
2026-08-27  01:41 AM        20,281,515 ExplicitDacl.compact.json
2026-08-27  01:41 AM       342,346,709 ExplicitDacl.plain.json
2026-08-27  01:41 AM               791 ExplicitDacl.summary.txt
2026-08-27  01:49 AM        19,662,890 ExplicitSacl.compact.json
2026-08-27  01:49 AM        56,349,000 ExplicitSacl.plain.json
2026-08-27  01:49 AM               789 ExplicitSacl.summary.txt
2026-08-27  02:50 AM        19,660,291 ExtendedAttributes.compact.json
2026-08-27  02:50 AM        38,615,012 ExtendedAttributes.plain.json
2026-08-27  02:50 AM               813 ExtendedAttributes.summary.txt
2026-08-27  02:18 AM        19,666,582 FileAttributes.compact.json
2026-08-27  02:18 AM        37,970,643 FileAttributes.plain.json
2026-08-27  02:18 AM               798 FileAttributes.summary.txt
2026-08-27  03:38 AM        60,897,540 FileId.compact.json
2026-08-27  03:37 AM        57,830,247 FileId.plain.json
2026-08-27  03:38 AM               770 FileId.summary.txt
2026-08-27  03:29 AM        25,182,315 FileSize.compact.json
2026-08-27  03:28 AM        38,463,886 FileSize.plain.json
2026-08-27  03:29 AM               777 FileSize.summary.txt
2026-08-27  02:15 AM        19,663,298 Group.compact.json
2026-08-27  02:14 AM        64,735,817 Group.plain.json
2026-08-27  02:15 AM               761 Group.summary.txt
2026-08-27  03:19 AM        80,085,932 HardLinks.compact.json
2026-08-27  03:18 AM       107,571,053 HardLinks.plain.json
2026-08-27  03:19 AM               781 HardLinks.summary.txt
2026-08-27  02:42 AM        19,660,303 Integrity.compact.json
2026-08-27  02:42 AM        43,548,421 Integrity.plain.json
2026-08-27  02:42 AM               777 Integrity.summary.txt
2026-08-27  02:31 AM        66,168,056 LastAccessTime.compact.json
2026-08-27  02:30 AM        58,608,352 LastAccessTime.plain.json
2026-08-27  02:31 AM               802 LastAccessTime.summary.txt
2026-08-27  02:26 AM        28,237,165 LastWriteTime.compact.json
2026-08-27  02:25 AM        58,608,350 LastWriteTime.plain.json
2026-08-27  02:26 AM               797 LastWriteTime.summary.txt
2026-08-27  04:10 AM        19,660,309 ObjectId.compact.json
2026-08-27  04:10 AM        45,755,470 ObjectId.plain.json
2026-08-27  04:10 AM               773 ObjectId.summary.txt
2026-08-27  02:08 AM        19,662,941 Owner.compact.json
2026-08-27  02:08 AM        59,851,570 Owner.plain.json
2026-08-27  02:08 AM               761 Owner.summary.txt
2026-08-27  02:59 AM        19,661,399 ReparsePoint.compact.json
2026-08-27  02:59 AM        45,626,094 ReparsePoint.plain.json
2026-08-27  02:59 AM               789 ReparsePoint.summary.txt
2026-08-27  02:02 AM        19,660,918 SaclInheritance.compact.json
2026-08-27  02:01 AM        62,587,132 SaclInheritance.plain.json
2026-08-27  02:02 AM               801 SaclInheritance.summary.txt
2026-08-27  02:39 AM        19,660,527 Sparse.compact.json
2026-08-27  02:39 AM        39,347,474 Sparse.plain.json
2026-08-27  02:39 AM               765 Sparse.summary.txt
2026-08-27  04:32 AM        19,661,474 Usn.compact.json
2026-08-27  04:32 AM        41,730,882 Usn.plain.json
2026-08-27  04:32 AM               753 Usn.summary.txt

I find it strange in the last 10 years, nobody has created those tools. I imagine if anyone has, they either gave up, died or never published them because I just can't find them. Or they sold out.

But still, it's kind of crazy that the solution is "delete your thin pool and all your volumes and start over fresh" is the only solution to "how to shrink a thin pool" !