On Tue, Jul 15, 2025 at 07:21:22PM +0530, Priya PM wrote: > For example, > /mnt/fs1 has file1 of size 40KB > Do a reflink cp of /mnt/fs1 to /mnt/.snap/1 > Now, when I check the size of /mnt/.snap/1/, it should show only snap > usage. In this case, it should be 0, as no blocks are unique to this > snap. > Modify file1 in /mnt/fs1, modify 2 blocks of block size 4 KB. > Take snapshot /mnt/snap/2 --.> This should show only the unique snap > usage as 8KB. > > I understand there is no snap accounting in XFS. However, to achieve > the above things, is there any XFS command that can help? reflinked blocks are not owned by either file, so the usage is shared by them. There's a few things you could theoretically do: - check how many non-shared blocks a file has. The easiest way to do that would be to call fiemap on the inode, and count the extents that don't have the shared flag set on them. You'd probably need to write that at the C level, as the filefrag and xfs_io fiemap commands aren't all that great - look how many shared vs unshared block a file system has in total. For thay you'd want a rmap-enabled file system and look at the fsmap output.