6

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

5 Answers 5

8

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:

  • end-point e.g. https://s3-buket.example.com
  • access-key e.g. jgDbxCy9Uv35sQ7H
  • secret-key e.g. EQqSA5OZLVYqZSztbgq28Seezn9pkX4V

and set it:

minmc alias set s3p https://s3-buket.example.com 'jgDbxCy9Uv35sQ7H' 'EQqSA5OZLVYqZSztbgq28Seezn9pkX4V'
  • minmc MinIO client
  • alias set options
  • s3p a name

after 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

enter image description here


source

7

You can do something like this:

mc ls -r --json your_bucket_path | awk '{ FS=","; print $4 }' | awk '{ FS=":"; n+=$2 } END{ print n }'
1
  • 2
    Or using jq instead of awk: mc ls -r --json your_bucket_path | jq -s 'map(.size) | add'
    – Jeff
    Oct 28, 2020 at 19:46
3

Inspired by @mikijov, but using jq instead of awk:

mc ls -r --json your_bucket_path | jq -s 'map(.size) | add'
2

Show human-readable size:

mc ls -r --json your_bucket_path | jq -s 'map(.size) | add' | numfmt --to=iec-i --suffix=B --padding=7
1

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.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.