Re: Finding the holes in sparse files.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Check my post here 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@xxxxxxxxxx> 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@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/ext3-users

_______________________________________________
Ext3-users mailing list
Ext3-users@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/ext3-users



--
Sponser and operater: Linux monitoring solution: http://www.admon.org
_______________________________________________
Ext3-users mailing list
Ext3-users@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/ext3-users

[Index of Archives]         [Linux RAID]     [Kernel Development]     [Red Hat Install]     [Video 4 Linux]     [Postgresql]     [Fedora]     [Gimp]     [Yosemite News]

  Powered by Linux