Bug 1342804 - ceph-fs does not create sparse files
Summary: ceph-fs does not create sparse files
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Ceph Storage
Classification: Red Hat Storage
Component: CephFS
Version: 2.0
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: 2.0
Assignee: John Spray
QA Contact: ceph-qe-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-06-05 12:05 UTC by rakesh-gm
Modified: 2017-07-30 15:00 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-06-08 14:10:31 UTC
Embargoed:


Attachments (Terms of Use)

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.


Note You need to log in before you can comment on or make changes to this bug.