Hi Jasper,
On 16.12.21 12:45, Jesper Lykkegaard Karlsen wrote:
Now, I want to access the usage information of folders with quotas from root
level of the cephfs.
I have failed to find this information through getfattr commands, only quota
limits are shown here, and du-command on individual folders is a suboptimal
solution.
`getfattr -n ceph.quota.max_bytes /path` gives the specified quota for a
given path.
`getfattr -n ceph.dir.rbytes /path` gives the size of the path, as you
would usually get with du for conventional file systems.
As an example, I am using this script for weekly utilisation reports:
for i in /ceph-path-to-home-dirs/*; do
if [ -d "$i" ]; then
SIZE=$(getfattr -n ceph.dir.rbytes --only-values "$i")
QUOTA=$(getfattr -n ceph.quota.max_bytes --only-values "$i" 2>/dev/null
|| echo 0)
PERC=$(echo $SIZE*100/$QUOTA | bc 2> /dev/null)
if [ -z "$PERC" ]; then PERC="--"; fi
printf "%-30s %8s %8s %8s%%\n" "$i" `numfmt --to=iec $SIZE` `numfmt
--to=iec $QUOTA` $PERC
fi
done
Note that you can also mount CephFS with the "rbytes" mount option. IIRC
the fuse clients defaults to it, for the kernel client you have to
specify it in the mount command or fstab entry.
The rbytes option returns the recursive path size (so the
ceph.dir.rbytes fattr) in stat calls to directories, so you will see it
with ls immediately. I really like it!
Just beware that some software might have issues with this behaviour -
alpine is the only example (bug report and patch proposal have been
submitted) that I know of.
Cheers
Sebastian
_______________________________________________
ceph-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]