Re: cephfs quota used

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: jelka@xxxxxxxxx
Tlf:    +45 50906203

________________________________
Fra: Konstantin Shalygin <k0ste@xxxxxxxx>
Sendt: 17. december 2021 09:17
Til: Jesper Lykkegaard Karlsen <jelka@xxxxxxxxx>
Cc: Robert Gallop <robert.gallop@xxxxxxxxx>; ceph-users@xxxxxxx <ceph-users@xxxxxxx>
Emne: Re:  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 <jelka@xxxxxxxxx<mailto:jelka@xxxxxxxxx>> 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@xxxxxxx
To unsubscribe send an email to ceph-users-leave@xxxxxxx




[Index of Archives]     [Information on CEPH]     [Linux Filesystem Development]     [Ceph Development]     [Ceph Large]     [Ceph Dev]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [xfs]


  Powered by Linux