[Libguestfs] virtdf outputs on host differs from df in guest

Chen Fan fan.chen at easystack.cn
Thu Jan 4 04:58:40 UTC 2018


hi guys,

   happy new year!!!

  I encountered  a problem when we used virt-df command to display my 
guest disks useage.

the virt-df command from pkg 
libguestfs-tools-c-1.36.3-6.el7_4.3.x86_64,version is  virt-df --version 
: virt-df 1.36.3rhel=7,release=6.el7_4.3,libvirt

the output in guest with the method referred in 
http://libguestfs.org/virt-df.1.html#STATVFS NUMBERS

is:

[root at localhost ~]# df
Filesystem              1K-blocks    Used Available Use% Mounted on
/dev/mapper/centos-root  23544596 4335172  19209424  19% /
devtmpfs                   931220       0    931220   0% /dev
tmpfs                      941860       0    941860   0% /dev/shm
tmpfs                      941860    8612    933248   1% /run
tmpfs                      941860       0    941860   0% /sys/fs/cgroup
/dev/sda1                  508588  133328    375260  27% /boot
tmpfs                      188376       0    188376   0% /run/user/0

using scripts:

python -c 'import os; s = os.statvfs ("/"); print s'
posix.statvfs_result(f_bsize=4096, f_frsize=4096, f_blocks=5886149, 
f_bfree=4802342, f_bavail=4802342, f_files=23556096, f_ffree=23435372, 
f_favail=23435372, f_flag=4096, f_namemax=255)

python -c 'import os; s = os.statvfs ("/boot"); print s'
posix.statvfs_result(f_bsize=4096, f_frsize=4096, f_blocks=127147, 
f_bfree=93815, f_bavail=93815, f_files=512000, f_ffree=511626, 
f_favail=511626, f_flag=4096, f_namemax=255)

and then on host using virt-df showing:

# sudo virt-df rpm-build-for-7.2

Filesystem                           1K-blocks       Used Available  Use%
rpm-build-for-7.2:/dev/sda1             508588     107728 400860   22%
rpm-build-for-7.2:/dev/centos/root    23544596    4298384 19246212   19%

using scripts:

# guestfish --ro -d rpm-build-for-7.2 -i statvfs /

bsize: 4096
frsize: 4096
blocks: 5886149
bfree: 4810534
bavail: 4810534
files: 23556096
ffree: 23435372
favail: 23435372
fsid: 64513
flag: 4097
namemax: 255

# sudo guestfish --ro -d rpm-build-for-7.2 -i statvfs /boot
bsize: 4096
frsize: 4096
blocks: 127147
bfree: 100215
bavail: 100215
files: 512000
ffree: 511626
favail: 511626
fsid: 2049
flag: 4097
namemax: 255

we can saw that in guest the statvfs get the value was the same with the 
"df" command output. but the bfree/bavail values are different between 
using guestfish statvfs on guest and

using statvfs in guest. I want to know whether is this a bug? or Does 
same reason cause this appearance?

Thanks,

Chen





More information about the Libguestfs mailing list