RHEL 7 or CentOS 7: How to view file extent information for XFS filesystem ?
In ext2, ext3, or ext4 filesystems, we used the command filefrag.
However for xfs filesystem, the filefrag command shows the offset values and the exact file extent values are not visible.
To see the exact file extent information, we need to use the “xfs_bmap” command.
Lets see the mapping of a file called “ifup”.
[root@ngelinux network-scripts]# xfs_bmap -v ifup ifup: EXT: FILE-OFFSET BLOCK-RANGE AG AG-OFFSET TOTAL 0: [0..15]: 1260240..1260255 0 (1260240..1260255) 16
Similarly we can see the extent information of any other file, say testfile.
[root@ngelinux ~]# xfs_bmap testfile testfile: 0: [0..7]: 6745576..6745583 [root@ngelinux ~]# xfs_bmap -v testfile testfile: EXT: FILE-OFFSET BLOCK-RANGE AG AG-OFFSET TOTAL 0: [0..7]: 6745576..6745583 2 (249320..249327) 8 [root@ngelinux ~]#