Skip to contentSkip to conversation

Domain backup file explodes on s3fs

DISCUSSION Tim Haley 2 participants 2 messages Apr 7, 2020

lore
Share & tools
lore

Tim Haley

author
#0 lore raw

Hi all,

Have been playing with virsh backup-begin of late and think it's an excellent feature. I've noticed one behavior I'm not sure I understand. Am doing pretty straight-forward backup of boot disk:

# cat bx
<domainbackup>
  <disks>
    <disk name='vda' type='file'>
    <target file='/backups/vda.2aa450cc-6d2e-11ea-8de0-52542e0d008a'/>
      <driver type='qcow2'/>
    </disk>
  </disks>
</domainbackup>
# cat cx
<domaincheckpoint>
  <name>2aa450cc-6d2e-11ea-8de0-52542e0d008a</name>
  <disks>
    <disk name='vda' checkpoint='bitmap'/>
  </disks>
</domaincheckpoint>
# virsh backup-begin 721 bx cx

If my /backups directory is just XFS, I get a backup file that looks like it is just the size of data blocks in use

-rw------- 1 root root 2769551360 Mar 19 16:56 vda.2aa450cc-6d2e-11ea-8de0-52542e0d008a

but if I write to an s3fs (object storage backend) the file blows up to the whole size of the disk

-rw------- 1 root root 8591507456 Mar 18 19:03 vda.2aa450cc-6d2e-11ea-8de0-52542e0d008a

Is this expected?

If it's relevant, this is on ubuntu and

# virsh version
Compiled against library: libvirt 6.1.0
Using library: libvirt 6.1.0
Using API: QEMU 6.1.0
Running hypervisor: QEMU 4.2.0

thanks for any ideas,
-tim

#1 lore raw

[adding libvirt list]

Quoted 3 lines · Tim Haley

Hi all,

Have been playing with virsh backup-begin of late and think it's an excellent feature. I've noticed one behavior I'm not sure I understand.

It looks like https://bugzilla.redhat.com/show_bug.cgi?id=1814664 is a similar description of the same problem: namely, if qemu is not able to determine that the destination already reads as zero, then it forcefully zeroes the destination of a backup job. We may want to copy the fact that qemu 5.0 is adding 'qemu-img convert --target-is-zero' to add a similar knob to the QMP commands that trigger disk copying (blockdev-backup, blockdev-mirror, possibly others) as well as logic to avoid writing zeroes when the destination is already treated as zero (whether by a probe, or by the knob being set).

...

Quoted 4 lines

If my /backups directory is just XFS, I get a backup file that looks like it is just the size of data blocks in use

-rw------- 1 root  root  2769551360 Mar 19 16:56
vda.2aa450cc-6d2e-11ea-8de0-52542e0d008a

For a local file, qemu is easily able to probe whether the destination starts as all zeroes (thanks to lseek(SEEK_DATA));

Quoted 5 lines

but if I write to an s3fs (object storage backend) the file blows up to the whole size of the disk

-rw------- 1 root  root  8591507456 Mar 18 19:03
vda.2aa450cc-6d2e-11ea-8de0-52542e0d008a

whereas for s3fs, it looks like qemu does not have access to a quick test to learn if the image starts all zero (POSIX does not provide a quick way for doing this on a generic block device, but if you are aware of an ioctl or otherwise that qemu could use, that might be helpful). Or maybe the s3fs really is random contents rather than all zero, in which case forcefully writing zeroes is the only correct behavior.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org