Thanks Konstantin,

Actually, I went a bit further and made the script more universal in usage:

ceph_du_dir:
# usage: ceph_du_dir $DIR1 ($DIR2 .....)
for i in $@; do
    if [[ -d $i && ! -L $i ]]; then
echo "$(numfmt --to=iec --suffix=B --padding=7 $(getfattr --only-values -n 
ceph.dir.rbytes $i 2>/dev/nul) | sed -r 's/([0-9])([a-zA-Z])/\1 \2/g; 
s/([a-zA-Z])([0-9])/\1 \2/g') $i"
    fi
done

The above can be run as:

ceph_du_dir $DIR

with multiple directories:

ceph_du_dir $DIR1 $DIR2 $DIR3 ......

Or even with wildcard:

ceph_du_dir $DIR/*

Best,
Jesper

--------------------------
Jesper Lykkegaard Karlsen
Scientific Computing
Centre for Structural Biology
Department of Molecular Biology and Genetics
Aarhus University
Gustav Wieds Vej 10
8000 Aarhus C

E-mail: je...@mbg.au.dk
Tlf:    +45 50906203

________________________________
Fra: Konstantin Shalygin <k0...@k0ste.ru>
Sendt: 17. december 2021 09:17
Til: Jesper Lykkegaard Karlsen <je...@mbg.au.dk>
Cc: Robert Gallop <robert.gal...@gmail.com>; ceph-users@ceph.io 
<ceph-users@ceph.io>
Emne: Re: [ceph-users] cephfs quota used

Or you can mount with 'dirstat' option and use 'cat .' for determine CephFS 
stats:

alias fsdf="cat . | grep rbytes | awk '{print \$2}' | numfmt --to=iec 
--suffix=B"

[root@host catalog]# fsdf
245GB
[root@host catalog]#


Cheers,
k

On 17 Dec 2021, at 00:25, Jesper Lykkegaard Karlsen 
<je...@mbg.au.dk<mailto:je...@mbg.au.dk>> wrote:

Anyway, I just made my own ceph-fs version of "du".

ceph_du_dir:

#!/bin/bash
# usage: ceph_du_dir $DIR
SIZE=$(getfattr -n ceph.dir.rbytes $1 2>/dev/null| grep "ceph\.dir\.rbytes" | 
awk -F\= '{print $2}' | sed s/\"//g)
numfmt --to=iec-i --suffix=B --padding=7 $SIZE

Prints out ceph-fs dir size in "human-readble"
It works like a charm and my god it is fast!.....

Tools like that could be very useful, if provided by the development team 🙂

_______________________________________________
ceph-users mailing list -- ceph-users@ceph.io
To unsubscribe send an email to ceph-users-le...@ceph.io

Reply via email to