Description

This function retrieves the server's drive partition information.

Examples


https://hostname.example.com:2087/cpsess##########/json-api/getdiskusage?api.version=1
https://hostname.example.com:2087/cpsess##########/xml-api/getdiskusage?api.version=1
whmapi1 getdiskusage

{
  "data": {
    "partition": [
      {
        "disk": "mapper/vg_sandbox-lv_root",
        "filesystem": "/dev/mapper/vg_sandbox-lv_root",
        "mount": "/",
        "used": 13817704,
        "percentage": 48,
        "total": 30487496,
        "available": 15121096
      },
      {
        "disk": "vda1",
        "filesystem": "/dev/vda1",
        "mount": "\/boot",
        "used": 92388,
        "percentage": 20,
        "total": 495844,
        "available": 377856
      }
    ]
  },
  "metadata": {
    "version": 1,
    "reason": "Successfully retrieved disk usage",
    "result": 1,
    "command": "getdiskusage"
  }
}
<result>
    <data>
        <partition>
            <disk>mapper/vg_sandbox-lv_root</disk>
            <filesystem>/dev/mapper/vg_sandbox-lv_root</filesystem>
            <mount>/</mount>
            <used>13817836</used>
            <percentage>48</percentage>
            <total>30487496</total>
            <available>15120964</available>
        </partition>
        <partition>
            <disk>vda1</disk>
            <filesystem>/dev/vda1</filesystem>
            <mount>/boot</mount>
            <used>92388</used>
            <percentage>20</percentage>
            <total>495844</total>
            <available>377856</available>
        </partition>
    </data>
    <metadata>
        <version>1</version>
        <reason>Successfully retrieved disk usage</reason>
        <result>1</result>
        <command>getdiskusage</command>
    </metadata>
</result>

   

Parameters

This function does not accept parameters.

Returns

ReturnTypeDescriptionPossible valuesExample
partitionhashA hash of drive partition information.

This hash includes the diskfilesystemmountusedpercentagetotal, and available returns.

 

disk

string

The filesystem's label.

The function returns this value in the partition hash.

A valid string.
vda1

filesystem

string

The filesystem's location.

The function returns this value in the partition hash.

An absolute directory path./dev/vda1

mount

string

The filesystem's mount point.

The function returns this value in the partition hash.

A valid string./boot

used

integer

The filesystem's disk space used.

The function returns this value in the partition hash.

A positive integer, measured in kilobytes.92388

percentage

integer

The percent of the filesystem's total disk space used.

The function returns this value in the partition hash.

A positive integer.20

total

integer

The filesystem's total disk space allocated.

The function returns this value in the partition hash.

A positive integer, measured in kilobytes.
495844

available

integer

The filesystem's disk space unused.

The function returns this value in the partition hash.

A positive integer, measured in kilobytes.
377856