Eric Warnke wrote, sometime around 27/04/06 03:42:
> Unfortunately I have looked high and low, there is just no good way to
> read sparse files intelligently.  Whoever though of providing the
> functionality without an API to step through the block mapping was a
> moron.  It is truly a brain dead technology.  At least there is a fcntl
> under Win32 to deal with it with some intelligence.

As far as I know, there is no cross-platform way to do it, and in Linux,
no filesystem-agnostic way to do it.

XFS has a special ioctl, XFS_BMAP, or something like that. It returns a
list of extents occupied by the file, and from there you can work out
where the gaps are.

I think there were whispers on the linux-xfs/l-k mailing lists about
genericising this across all file systems, but I don't know if it
actually got taken up as a serious proposition.

Anyway, at least in XFS, it's possible.

# dd if=/dev/zero seek=50 of=foo count=100
100+0 records in
100+0 records out
51200 bytes (51 kB) copied, 0.000916 seconds, 55.9 MB/s
# xfs_bmap foo
foo:
        0: [0..47]: hole
        1: [48..151]: 20688..20791
#

Here we can see that the first 48 blocks are hole, and the next 103
blocks contain data (in this case, zeros). Presumably bacula would have
read this entire file as being one big hole, had it been backed up with
sparse turned on? If so, this could lead to a substantial disk space
discrepancy on a system if you back up with sparse turned on, and then
restore. (you'll have 'gained' any disk space previously occupied by zeros).

And no, you don't need to be root to perform the ioctl.

-- 
Russell Howe
[EMAIL PROTECTED]


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to