How to list bucket size in Ceph Object Gateway

How to List the Current Size of Buckets in Ceph Object Gateway

If you’re managing a Ceph cluster and need to check the size of your storage buckets, the radosgw-admin command is your go-to tool. This utility allows you to retrieve detailed statistics about each bucket, including its current size. Here’s how you can use it:

Listing Size for a Specific Bucket

To get statistics, including the size of a specific bucket, use the following command in your terminal:

radosgw-admin bucket stats --bucket=<bucket-name>

Replace <bucket-name> with the name of your bucket. This command provides detailed information, such as the number of objects in the bucket and the total size of these objects.

Listing Size for All Buckets

If you want to see the statistics for all buckets within your Ceph Object Gateway, simply use the command without specifying a bucket name:

radosgw-admin bucket stats

This will output a list of all buckets, along with detailed statistics for each, including the total size.

Understanding the Output

The output will include several pieces of information. Here’s an example of what you might see for a bucket’s size:

{
    "bucket": "your-bucket-name",
    "num_objects": 1234,
    "total_size": 56789012,
    "total_size_kb": 56789
}

In this output:

  • “bucket” is the name of the bucket.
  • “num_objects” indicates the total number of objects stored in the bucket.
  • “total_size” shows the total size of all objects in bytes.
  • “total_size_kb” is the total size in kilobytes.

This information can help you manage your storage more effectively by understanding the size and usage of each bucket.

Prerequisites

  • Ensure you have administrative access to the host where the Ceph Object Gateway is running.
  • Familiarity with terminal commands is required.

By following these steps, you can easily monitor and manage the storage utilization of your Ceph Object Gateway.