Re: Finding the holes in sparse files.

Joseph Chen <[email protected]>
Newsgroups gmane.comp.file-systems.ext3.user
Message-ID <[email protected]>
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 <[email protected]> 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
> > [email protected]
> > https://www.redhat.com/mailman/listinfo/ext3-users
>
> _______________________________________________
> Ext3-users mailing list
> [email protected]
> https://www.redhat.com/mailman/listinfo/ext3-users
>



-- 
Sponser and operater: Linux monitoring solution: http://www.admon.org

_______________________________________________
Ext3-users mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/ext3-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.