Created attachment 1366952 [details] Compressed sample image with mbr partition table, single fat32 partition in qcow2 format Description of problem: Call virt-df for disk image which contains filesystem with block size = 512 bytes. virt-df shows zeroes for such filesystems in all numeric fields (except Use%). But everything is OK if you call it with --human-readable option. Version-Release number of selected component (if applicable): Any. Tested on 1.36.10 Fedora 25 and 1.36.11 CentOS 6. How reproducible: virt-df -a disk.qcow2 Actual results: Filesystem 1K-blocks Used Available Use% disk.qcow2:/dev/sda1 0 0 0 1% Expected results: Filesystem 1K-blocks Used Available Use% disk.qcow2:/dev/sda1 99800 1 99800 1% Additional info: statvfs: bsize: 512 blocks: 199600 bfree: 199599 Here is a root of the issue: https://github.com/libguestfs/libguestfs/blob/master/df/output.c#L112
Can reproduce the same with virt-df 1.37.34fedora=28,release=3.fc28,libvirt
Relevant part of the trace output is: libguestfs: trace: statvfs "/" libguestfs: trace: statvfs = <struct guestfs_statvfs = bsize: 512, frsize: 512, blocks: 199600, bfree: 199599, bavail: 199599, files: 0, ffree: 0, favail: 0, fsid: 2049, flag: 4097, namemax: 1530, > Note that bsize = 512, therefore factor = bsize / 1024 = 0, so everything is multiplied by zero resulting in: image:/dev/sda1 0 0 0 1%
Patch posted: https://www.redhat.com/archives/libguestfs/2017-December/msg00051.html
This was fixed upstream with commit d3afdb6e3edbfe031aac86c14df60c530781ace5 which is in libguestfs >= 1.37.36.