Check reflink and spared space on XFS repositories

  • 18 November 2020
  • 1 comment
  • 3005 views

Userlevel 7
Badge +13

I wrote already a post about checking Microsoft ReFS space savings. Now I want to show some basics to check XFS savings too.

To check space savings on repository layer go to the repository directory and run: ls -lhs

You can see the size of each file and the total size of all files. If there a way to much files, run ls -lhs | grep total

 

Compare this to the size allocated on the volume. To show this, run df -h

 

In this example you see space savings of: (86 - 35) = 51G

 

Another way is the use the command xfs_bmap. It works on file-level and is very technical. I am still not sure to interpret all output correctly. At least it can show, reflink works!

To show all extents of a file, this command can be used:  xfs_bmap -e -l -p -v -v -v filename. Here also additional information like a legend is displayed.

I made a small script to show the size of all shared extents of all *.vbk-files. But do not overstrain it, its experimental.

#!/bin/bash
for f in *.vbk
do
echo "File $f size of shared extends:"
xfs_bmap -v $f | grep -v 100000 | awk '{print $6}' | grep -Eo '[0-9]{1,7}' | paste -sd+ | bc  | awk '{print $1*4096/1024/1024/1024}'
done

 


1 comment

Userlevel 7
Badge +14

Wow! This is awesome! Thank you so much for the post, looking forward to giving this a try.

Comment