Query on optimized full backup (only used/non-zero blocks)

Arshiya

New Member
May 30, 2025
6
0
1
Hello All,
Hope this message finds you well.

I have been trying proxmox for a while now and have come across a problem specific to optimized full backup (only used/non-zero blocks) of Proxmox VMs present on LVM & ZFS storage.

For directory & btrfs storage, I am able to get the allocated & unallocated blocks details which is really helpful using below commands:
1) modprobe nbd max_part=8
2) qemu-nbd --socket=/tmp/nbd.sock --read-only /btrfs/images/183/vm-183-disk-0/disk.raw &
3) nbdinfo --map 'nbd+unix:///?socket=/tmp/nbd.sock' --json > /backup/183_full_used_blocks.json

I am getting output like below for btrfs & directory storage VMs:

[
{ "offset": 0, "length": 4096, "type": 0, "description": "data"},
{ "offset": 4096, "length": 1044480, "type": 3, "description": "hole,zero"},
{ "offset": 1048576, "length": 176128, "type": 0, "description": "data"},
{ "offset": 1224704, "length": 2060288, "type": 3, "description": "hole,zero"}
]


But when I try the same commands for LVM & ZFS based VMs then it is showing the whole disk as allocated, below is the output I am getting for lvm & zfs VMs:
[
{ "offset": 0, "length": 34359738368, "type": 0, "description": "data"}
]

Can someone please help me with this? I want to get the allocated & unallocated blocks details to do the optimized full backup (full backup of only allocated blocks of disk) for VMs present on LVM & ZFS storage.

Thanks & Regards,
Arshiya
 
Last edited:
Can someone please help me with this?
The "problem" is that LVM and ZFS (CEPH would probably have the same problem) are block based files and your raw-files are file based. The abstraction lies in LVM and ZFS itself, so that you won't see that they're thin-provisioned, because you don't see that at the upper most layer. You will however see this in the nbd-mapped files.

Best to read the information from the actual tools that provide them, e.g. with ZFS:

Code:
$ zfs list -o name,volsize,refer rpool/data/vm-100-disk-0
NAME                      VOLSIZE  REFER
rpool/data/vm-100-disk-0      32G  1.99G

I want to get the allocated & unallocated blocks details to do the optimized full backup (full backup of only allocated blocks of disk) for VMs present on LVM & ZFS storage.
Do you want to do this by hand? This is normally what PBS does internally if it does not use the delta block tracking.
 
The "problem" is that LVM and ZFS (CEPH would probably have the same problem) are block based files and your raw-files are file based. The abstraction lies in LVM and ZFS itself, so that you won't see that they're thin-provisioned, because you don't see that at the upper most layer. You will however see this in the nbd-mapped files.

Best to read the information from the actual tools that provide them, e.g. with ZFS:

Code:
$ zfs list -o name,volsize,refer rpool/data/vm-100-disk-0
NAME                      VOLSIZE  REFER
rpool/data/vm-100-disk-0      32G  1.99G


Do you want to do this by hand? This is normally what PBS does internally if it does not use the delta block tracking.
Thank You for the response!

Can you please tell me how PBS does it? We want to try by hand or program.

Thanks, & Regards,
Arshiya
 
AFAIK :
PVE backend for VM is QEMU , backup starts VM (QEMU process) , even for offline VM,
to fully read VM's vDisk(s).
It's not really PBS thing , as PBS "only" receive data from PVE/QEMU,
then PBS discards data if it has already same data even it data is empty.
Another point for PBS : it really speeds up "Daily Live" backups thanks to QEMU "dirty bitmap" which avoids fully reading vDisk(s), only changed blocks from previous backup is read. ( back to full reading if VM/QEMU process is shutdown).

(sorry for my wording as not English here )
 
Last edited:
  • Like
Reactions: Johannes S