Minio bucket size
Asked Answered
L

5

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

Languor answered 6/2, 2019 at 6:46 Comment(0)
H
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

Hypochondriasis answered 4/6, 2021 at 9:27 Comment(0)
K
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 }'
Kamerad answered 31/5, 2019 at 13:41 Comment(1)
Or using jq instead of awk: mc ls -r --json your_bucket_path | jq -s 'map(.size) | add'Restore
R
3

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

mc ls -r --json your_bucket_path | jq -s 'map(.size) | add'
Restore answered 28/10, 2020 at 19:44 Comment(0)
P
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
Pothead answered 22/2, 2021 at 12:57 Comment(0)
R
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.

Restore answered 25/2, 2023 at 5:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.