From 'man lseek' (man pages are your friend. First place to look for information.)
SEEK_HOLE
Adjust the file offset to the next hole in the file greater than
or equal to offset. If offset points into the middle of a hole,
then the file offset is set to offset. If there is no hole past
offset, then the file offset is adjusted to the end of the file
(i.e., there is an implicit hole at the end of any file).
In other words, you're seeing entirely expected behavior. There's no hole in ls
, so you're getting a hole at the end of the file.
You can create a sparse file for testing with dd
:
dd if=/dev/zero of=sparsefile bs=1 count=1 seek=40G
As for your final question: No, that's not reasonable. It's entirely likely that files will have 0 bytes in them. This does not indicate that they're a sparse file.