glusterdf - df for gluster volumes

Sep 24, 2013
2 minutes read.
glusterfs tools glusterfsblog

A CLI utility to check the disk usage of Gluster volumes. Using df command we can view the disk usage of only mounted glusterfs volumes. This utility takes care of mounting gluster volumes available in the machine where this command is executed. glusterdf uses libgfapi provided by glusterfs to fetch the statvfs information.

Installation is very simple,

git clone
cd glusterfs-tools
sudo python install

You can also clone this project from

Once installed, two tools will be available glustervolumes and glusterdf.

sudo glusterdf --help to know more about options available. (same for glustervolumes sudo glustervolumes --help)

Usage examples:

glusterdf -h
sudo glusterdf -h (Disk usage in human readable format)
glusterdf -i
sudo glusterdf -i (View inodes usage information)
sudo glusterdf --status up --type repl -h
sudo glusterdf --status up --type repl -h (View all running replicated volumes)
sudo glusterdf -h --volumewithbrick "/b[12]"
sudo glusterdf -h --volumewithbrick "/b[12]"
sudo glusterdf --status up --type repli -h --json | python -m json.tool
sudo glusterdf --status up --type repli -h --json | python -m json.tool
glusterdf --help
sudo glusterdf --help

In my previous blog(this) I wrote about gfvolumes(now it is glustervolumes). glusterfs-tools is rewritten as python library which can be used with your Python programs.

For example

from glusterfstools import volumes, gfapi
# Get all volumes
vols = volumes.get()
# Get a specific volume information
vol = volumes.get(name="gv1")
# Search volumes by status
down_volumes ={"status": "down"})
# Search volumes by type
distribute_volumes ={"type": "distribute"})
# Statvfs information
vol_statvfs = gfapi.statvfs("gv1")
# To view information about gluster volumes which are down
# and having bricks like "/gfs"
vols ={"status": "down", "volumewithbricks": "/gfs"})
# To view filters available
print (volumes.filters()) accepts filters as parameter, extending volume filters is very simple. For example name filter looks like this(src/glusterfstools/

def name_filter(vols, value):
    def is_match(vol, value):
        if value in ['', 'all'] or \
            vol["name"].lower() == value.lower().strip() or \
  , vol["name"]):
            return True
            return False

    return [v for v in vols if is_match(v, value)]

The filter can be used as below

from glusterfstools import volumes

# Filters the volumes with name either gv1 or gv2
filters = {"name": "gv[12]"}

About Aravinda Vishwanathapura

Co-Founder & CTO at Kadalu Technologies, Creator of Sanka, Creator of Chitra, GlusterFS core team member, Maintainer of Kadalu Storage
Contact: Linkedin | Twitter | Facebook | Github |