What works listing blocks on all disks independent from file systems? (low-level). And what works with FAT and NTFS?
The LBA number and bad block detection is total independent of the file system. Finding files is completely dependent on the filesystem. Don't expect a single tool to work for all filesystems.
You can use badblocks
to scan for bad blocks, you can use smartctl
to get the LBA(s) of reallocated blocks or bad blocks detected by the harddisk firmware, and you can use fdisk
etc. if you want to calculate between partition-relative numbers (if you did e.g. badblocks /dev/sda1
and LBAs.
As mentioned in the other answer, you can find the affected files for ext2/ext3/ext3 with debugfs
.
You can use the fibmap ioctl to find the LBA of the n-th block of a given file for all filesystems, but if you want to find the file for a given LBA, this is probably not practical. There's also filefrag
, which probably uses this ioctl.
I'm sure there are forensic tools for FAT (and possibly even for NTFS) which find a file for a given block number, but I couldn't name any offhand.
Edit
Googling finds fatcat for forensic analysis of FAT filesystems; it seems with -L
you can get a file for a specific cluster (which you can calculate from the LBA). I have no experience with this program. Googling more will probably turn up more such programs.