The FIBMAP ioctl() is an obscure and rarely used ioctl() that returns the file system block number of a file.
To find the Nth block of a file, one uses the FIBMAP ioctl() as follows:
int block = N;
int ret = ioctl(fd, FIBMAP, &block);
fd is the opened file descriptor of the file being examined,
N is the Nth block,
block is the returned file system block number of the Nth block.
fibmap.c is example of a program that interrogates all the blocks of a file and dumps them out to stdout. From this one can see if a large file is contiguously allocated on your filesystem. One needs to have super user priviliges to be able to perform the FIBMAP ioctl, so run it using sudo. Any ideas for a good use of this ioctl() are most welcome!
An alternative way to observe the output from fibmap is to use hdparm:
sudo hdparm --fibmap /initrd.img
/initrd.img: underlying filesystem: blocksize 4096, begins at LBA 63; assuming 512 byte sectors
byte_offset begin_LBA end_LBA sectors
0 860223 868414 8192
4194304 14114879 14122334 7456
Also check out the fiemap ioctl() for getting extent information from a file's inode.