Re: cephfs quota used

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

 



Thanks everybody,

That was a quick answer.

getfattr -n ceph.dir.rbytes $DIR

Was the answer that worked for me. So getfattr was the solution after all.

Is there some way I can display all attributes, without knowing them in forehand?

I have tried:

getfattr -d -m 'ceph.*' $DIR

which gives me no output. Should that not list all atributes?

This is on Rocky Linux kernel 4.18.0-348.2.1.el8_5.x86_64

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: Sebastian Knust <sknust@xxxxxxxxxxxxxxxxxxxxxxx>
Sendt: 16. december 2021 13:01
Til: Jesper Lykkegaard Karlsen <jelka@xxxxxxxxx>; ceph-users@xxxxxxx <ceph-users@xxxxxxx>
Emne: Re:  cephfs quota used

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 -- 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