On Thu, Jan 04, 2018 at 12:58:40PM +0800, Chen Fan wrote: [In guest]
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)
[From the host via libguestfs]
# 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
Was the guest quiescent and fully sync()d before you ran the python commands? In any case all that libguestfs is doing is executing the statvfs(2) system call on a copy of the disk: https://github.com/libguestfs/libguestfs/blob/e6e23c4d77ee15779f833fd4fbe6c5... So if there's any difference then it's something to do with the guest kernel vs the host kernel calculations. I wouldn't expect the numbers to be exactly the same, but libguestfs doesn't alter the numbers, it just passes them through. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW