I want to calculate bucket size of minio. is it possible to calculate storage quota using MinioClient? or is there any best way to calculate bucket size of minio storage.
thanks in advance
I want to calculate bucket size of minio. is it possible to calculate storage quota using MinioClient? or is there any best way to calculate bucket size of minio storage.
thanks in advance
Yes we can.
first
Downlaod the client e.g. https://dl.min.io/client/mc/release/linux-amd64/mc or any other OS you have
second
set the proper configuration which you need:
https://s3-buket.example.com
jgDbxCy9Uv35sQ7H
EQqSA5OZLVYqZSztbgq28Seezn9pkX4V
and set it:
minmc alias set s3p https://s3-buket.example.com 'jgDbxCy9Uv35sQ7H' 'EQqSA5OZLVYqZSztbgq28Seezn9pkX4V'
minmc
MinIO clientalias set
optionss3p
a nameafter running it we will see:
Added `s3p` successfully.
third
then you can run / use mc
sub-command e.g. ls
, du
, etc
here is a screenshot
You can do something like this:
mc ls -r --json your_bucket_path | awk '{ FS=","; print $4 }' | awk '{ FS=":"; n+=$2 } END{ print n }'
Inspired by @mikijov, but using jq instead of awk:
mc ls -r --json your_bucket_path | jq -s 'map(.size) | add'
Show human-readable size:
mc ls -r --json your_bucket_path | jq -s 'map(.size) | add' | numfmt --to=iec-i --suffix=B --padding=7
The minio client mc
as of version 2019-08-14T20-49-49Z has a du
subcommand that can be used as follows to determine the size of a bucket:
mc du --depth 1 <alias>/your_bucket_path
where <alias>
is a configuration for an S3 endpoint in accordance with the mc documentation.
© 2022 - 2024 — McMap. All rights reserved.
mc ls -r --json your_bucket_path | jq -s 'map(.size) | add'
– Restore