Description of problem: I was creating a sparse file on cephfs fuse client and kernel client using the command below "dd if=/dev/zero of=fedora.img bs=1 count=0 seek=8G" when I use du -sh as shown below 1. du -sh fedora.img 8.0G fedora.img -- the size is 8 Gig. this should be zero. 2. du -sh --apparent-size fedora.img 8.0G fedora.img -- the size is 0. This is correct. i used the same commands and created on ext4. 1. du -sh fedora.img 0 fedora.img 2. du -sh --apparent-size fedora.img 8.0G fedora.img
Good news: CephFS does actually create sparse files. Bad news: CephFS does not track how much data is actually in a sparse file, so the output it gives to tools like du will always show the maximum possible size for the file. If you want to test sparse files, the way to do it is to look at the object counts in "ceph df" after you create the sparse file: you'll see that the number of objects created corresponds to the number of 4MB regions that actually contain data.