I had a VM on a host with one scsi0 hard disk (local-lvm:vm-106-disk-0,discard=on,format=raw,iothread=1,size=512G,ssd=1) backed by a SCSI controller (VirtIO SCSI Single) on a g35 machine. The filesystem is an ext4 filesystem, with a basic Debain installation. This was on a Proxmox 8.3.4 instance with a LVM-Thin type local storage. On the storage, 20GB of disk space was used. I ran
On the receiving Proxmox instance (Proxmox 8.4.1), it was also moved to local storage (type LVM-Thin) but created the disk as a full 512GB-occupied disk. No thin or sparse creation. Expanded it to a full mapped disk. I ran
**This seems like a bug that it didn't create the VM in its thin form the way it was on the source material (and clearly if it was only taking up 20GB on the source, the unused portions were null). Running
I tried
This reclaimed the 482GB on /dev/sda2 and 500MB on /dev/sda1 that I expected. It saw a >500GB drop in the LVM-thin usage.
AND AFTER THE ZEROING NOTED ABOVE
fstrim -av
on the VM prior to migration. I then did a live migration of the VM to another Proxmox instance.On the receiving Proxmox instance (Proxmox 8.4.1), it was also moved to local storage (type LVM-Thin) but created the disk as a full 512GB-occupied disk. No thin or sparse creation. Expanded it to a full mapped disk. I ran
fstrim -av
again in the VM but it had nothing material to clear. The disk configuration is unchanged of course (discard still on, raw format).**This seems like a bug that it didn't create the VM in its thin form the way it was on the source material (and clearly if it was only taking up 20GB on the source, the unused portions were null). Running
lvdisplay
, it has mapped ~100% of the disk (see below). It seems like a bug that PDM didn't create this thin disk the way it was, but instead moved it in a way that mapped all of the space.I tried
- running
fstrim -av
again, with nothing material being pruned - restarting the VM with a full shutdown and power-on, in hopes it would do a reclaim on boot
- a LVM-resize with 0 through the GUI, which didn't shrink the used space.
- The thing that did work (*within the VM as root to avoid the reserved 5% of filesystem space*)
Bash:
dd if=/dev/zero of=/zeros; sync; rm /zeros
dd if=/dev/zero of=/boot/efi/zeros ; sync ; rm /boot/efi/zeros
swapoff -a && swapon --discard=once -a
fstrim -av
This reclaimed the 482GB on /dev/sda2 and 500MB on /dev/sda1 that I expected. It saw a >500GB drop in the LVM-thin usage.
* Why did PDM move it in a way that didn't maintain the discarded blocks?
* How can I migrate via PDM while maintaining my thin disks so I don't have to go through this (or where filling the disk isn't possible)?
VM106# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 502G 20G 457G 5% /
/dev/sda1 511M 5.9M 506M 2% /boot/efi
NEWSERVER# pvesm status
Name Type Status Total Used Available %
local dir active 98497780 6431208 87017024 6.53%
local-lvm lvmthin active 832888832 549623340 283265491 65.99%
NEWSERVER# qm list
VMID NAME STATUS MEM(MB) BOOTDISK(GB) PID
100 abc running 16384 512.00 1202
101 pdm running 2048 32.00 2303361
106 def running 16384 512.00 2312267
NEWSERVER# qm listsnapshot 106
`-> current You are here!
NEWSERVER# lvdisplay /dev/pve/vm-106-disk-0
--- Logical volume ---
LV Path /dev/pve/vm-106-disk-0
LV Name vm-106-disk-0
VG Name pve
LV UUID flHaEk-518s-sk6G-FMrc-KMhr-00GI-DqhqYZ
LV Write Access read/write
LV Creation host, time junction, 2025-05-08 15:14:37 -0400
LV Pool name data
LV Status available
# open 1
LV Size 512.00 GiB
Mapped size 99.46%
Current LE 131072
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:10
AND AFTER THE ZEROING NOTED ABOVE
NEWSERVER# lvdisplay /dev/pve/vm-106-disk-0
--- Logical volume ---
LV Path /dev/pve/vm-106-disk-0
LV Name vm-106-disk-0
VG Name pve
LV UUID flHaEk-518s-sk6G-FMrc-KMhr-00GI-DqhqYZ
LV Write Access read/write
LV Creation host, time junction, 2025-05-08 15:14:37 -0400
LV Pool name data
LV Status available
# open 1
LV Size 512.00 GiB
Mapped size 5.75%
Current LE 131072
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:10