Finding the holes in sparse files.

Joseph Chen cax0cn at gmail.com
Thu Mar 11 02:47:23 UTC 2010


Check my post here How to Check Sparse Files with
Perl<http://planet.admon.org/howto/how-to-check-sparse-files-with-perl/>

For any issues plesae let me know :)

J

On Thu, Mar 11, 2010 at 3:43 AM, Eric Sandeen <sandeen at redhat.com> wrote:

> Sean McCauliff wrote:
> > Is there a way to find the holes in sparse files, other than assuming
> > contiguous blocks of zeroes are holes?
>
> yes, programatically you can use a couple ioctls:
> fibmap (block-at-a-time) or fiemap in newer kernels.
>
> If you want a commandline, try filefrag -v.
>
> For ioctl usage examples, take a look at how filefrag is implemented.
>
> # dd if=/dev/zero of=testfile bs=4k count=1; dd if=/dev/zero of=testfile
> conv=notrunc bs=4k seek=4 count=1
> # sync
> # filefrag -v testfile
> Filesystem type is: ef53
> File size of testfile is 20480 (5 blocks, blocksize 4096)
>  ext logical physical expected length flags
>   0       0  1829913               1
>   1       4  1802777  1829913      1 eof
> testfile: 2 extents found
>
> the logical+length gap shows you that there was a hole in there
>
> Andreas has patches to make it still clearer in the table output.
>
> -Eric
>
> > Thanks,
> > Sean
> >
> > _______________________________________________
> > Ext3-users mailing list
> > Ext3-users at redhat.com
> > https://www.redhat.com/mailman/listinfo/ext3-users
>
> _______________________________________________
> Ext3-users mailing list
> Ext3-users at redhat.com
> https://www.redhat.com/mailman/listinfo/ext3-users
>



-- 
Sponser and operater: Linux monitoring solution: http://www.admon.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/ext3-users/attachments/20100311/78564037/attachment.htm>


More information about the Ext3-users mailing list