Hi,

How do you get the true size of a sparse file? Using /var/log/lastlog
on Ubuntu as an example I see this with "ls -lh"

287K lastlog

With "ls -sh" I see this:

40K lastlog

A File.stat call reveals this:

#<File::Stat
 dev=0x801,
 ino=5249695,
 mode=0100664 (file rw-rw-r--),
 nlink=1,
 uid=0 (root),
 gid=43 (utmp),
 rdev=0x0 (0, 0),
 size=292876,
 blksize=4096,
 blocks=80,
 atime=Mon Jan 03 16:03:24 -0700 2011 (1294095804),
 mtime=Thu Oct 21 11:34:51 -0600 2010 (1287682491),
 ctime=Thu Oct 21 11:34:51 -0600 2010 (1287682491)>

Multiplying blocks * blksize doesn't seem to match up, either.

How do I arrive at 40k?

Also, how would one go about detecting a sparse file?

Regards,

Dan