FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > EXT3 Users

 
 
LinkBack Thread Tools
 
Old 03-10-2010, 06:23 PM
Sean McCauliff
 
Default Finding the holes in sparse files.

Is there a way to find the holes in sparse files, other than assuming
contiguous blocks of zeroes are holes?


Thanks,
Sean

_______________________________________________
Ext3-users mailing list
Ext3-users@redhat.com
https://www.redhat.com/mailman/listinfo/ext3-users
 
Old 03-10-2010, 06:43 PM
Eric Sandeen
 
Default Finding the holes in sparse files.

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

_______________________________________________
Ext3-users mailing list
Ext3-users@redhat.com
https://www.redhat.com/mailman/listinfo/ext3-users
 
Old 03-11-2010, 01:47 AM
Joseph Chen
 
Default Finding the holes in sparse files.

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@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@redhat.com

> https://www.redhat.com/mailman/listinfo/ext3-users



_______________________________________________

Ext3-users mailing list

Ext3-users@redhat.com

https://www.redhat.com/mailman/listinfo/ext3-users



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

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

Thread Tools




All times are GMT. The time now is 09:57 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org