Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
This project is now read‑only. Starting Monday, February 2, please use https://ibm-ceph.atlassian.net/ for all bug tracking management.

Bug 1342804

Summary: ceph-fs does not create sparse files
Product: [Red Hat Storage] Red Hat Ceph Storage Reporter: rakesh-gm <rgowdege>
Component: CephFSAssignee: John Spray <john.spray>
Status: CLOSED NOTABUG QA Contact: ceph-qe-bugs <ceph-qe-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 2.0CC: ceph-eng-bugs, john.spray
Target Milestone: rc   
Target Release: 2.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-08 14:10:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description rakesh-gm 2016-06-05 12:05:11 UTC
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

Comment 2 John Spray 2016-06-08 14:10:31 UTC
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.