This is the development version of Kanrisuru. Since this is still a pre-1.0 release, we don't recommend using this in system-critical production environments.



Get disk usage for a filesystem in ruby.
linux manual

Basic Usage

require 'kanrisuru'
host = '', username: 'ubuntu', keys: ['~/.ssh/id_rsa'])

result = host.df



Field Type Description
path string
A path of the mounted filesystem
inodes boolean
List inode information instead of block usage (capacity field)


Returns an array of DiskFree structs.

DiskFree Fields

Field Type Description
file_system string Where the disk device is stored
type string Filesystem formatted partition type (ext4, xfs, fat, etc)
total integer Total disk space available for this mounted partition (in Kilobytes)
used integer Amount of disk space used in the partition (in Kilobytes)
capacity integer Either the capacity is in the number of blocks used, or number of inodes used depending on the inodes option
mount string Where the partition is mounted to

Return Example

  capacity = 80,
  file_system = "/dev/vda1",
  mount = "/",
  total = 7950756,
  type = "ext4",
  used = 1628860

Exit Status

Code Description
0 Success
1 Failure

Tested On

  • Ubuntu, Debian, Centos, Fedora, Redhat, OpenSuse, SLES