jcfilesize
I once wanted to find out how big a block device was, and I knew
of no better way to do it than to try and read from different
places and note where I get read errors. I still don't know a
better way, but I have automated the process. jcfilesize is a
small program that reads from exponentially larger positions in
a file until the end is found, and then does a binary search to
find the exact position of the end and prints the size using
several notations.
Instead of searching for the end, it can find the place where
the file begins or stops to contain only zeroes, which has
proven useful to get status reports when filling a partition
with zeros or random data, or to find out how much of a
partition that has been used by a filesystem.
Downloadjcfilesize --help produces:
This is jcfilesize version 0.5. Usage: jcfilesize filename ["zeros"|"notzeros" [blocksize]] |
|
Jörgen Cederlöf <jc@lysator.liu.se> |