how to get size of folder including apparent size of sparse files? (du is too slow)
问题 I have a folder containing a lot of KVM qcow2 files, they are all sparse files. Now I need to get the total size of folder, the qcow2 file size should be counted as apparent size(not real size). for example: image: c9f38caf104b4d338cc1bbdd640dca89.qcow2 file format: qcow2 virtual size: 100G (107374182400 bytes) disk size: 3.3M cluster_size: 65536 the image should be treated as 100G but not 3.3M originally I use statvfs() but it can only return real size of the folder. then I switch to 'du -