The way to find out a file's range of LBA on Linux



Sometimes, we want to know about file’s LBA(Logical Block Address) in linux. Some program write file based on lba, and we want to know sometime. In that time, you can use under command. We can easily see LBA of file.

sudo hdparm --fibmap afile 

The result is as follows. You can easillly get lba of file.

filesystem blocksize 4096, begins at LBA 0; assuming 512 byte sectors.
byte_offset  begin_LBA    end_LBA    sectors
          0  230284974  230284992         18