Disks Plugin

The Disks plugin adds the DISKS table to the Information Schema, providing metadata about the system's disk storage and usage.

The DISKS plugin creates the DISKS table in the INFORMATION_SCHEMA database. This table shows metadata about disks on the system, enabling monitoring of the disk space status. Accessing the INFORMATION_SCHEMA.DISKS table requires the FILE privilege.

The plugin is supported on Linux systems only.

Installing the Plugin

Although the plugin's shared library is distributed with MariaDB by default, the plugin is not actually installed by MariaDB automatically. There are two methods that can be used to install the plugin with MariaDB.

The first method can be used to install the plugin without restarting the server. You can install the plugin dynamically by executing INSTALL SONAME or INSTALL PLUGIN:

INSTALL SONAME 'disks';

The second method can be used to tell the server to load the plugin when it starts up. The plugin can be installed this way by providing the --plugin-load or the --plugin-load-add options. This can be provided as a command-line argument to mysqld or specified in a relevant server option group in an option file:

[mariadb]
...
plugin_load_add = disks

Example

After the plugin is installed, the INFORMATION_SCHEMA.DISKS table displays disk utilization information.

To view disk usage information, run the following query:

SELECT * FROM information_schema.DISKS;

Example Output

Column Descriptions

The INFORMATION_SCHEMA.DISKS table contains the following columns:

  • Disk: The name of the disk device or partition.

  • Path: The mount point where the disk is mounted.

  • Total: The total disk space available on the disk (in KiB).

  • Used: The amount of disk space currently used (in KiB).

  • Available: The amount of disk space available to non-root users (in KiB).

Note: As root users may have more available space than non-root users, Available + Used may be less than Total.

Additionally, all paths to which a specific disk is mounted are reported, so a disk may appear multiple times in the output.

Alternative: Mounts Table

As an alternative option, the plugin includes the INFORMATION_SCHEMA.MOUNTS table, which contains mount points and their respective disks.

For example:

Expected Output

Versions

Options

disks

  • Description: Controls how the server should treat the plugin when the server starts up.

    • Valid values are:

      • OFF - Disables the plugin without removing it from the mysql.plugins table.

      • ON - Enables the plugin. If the plugin cannot be initialized, then the server will still continue starting up, but the plugin will be disabled.

      • FORCE - Enables the plugin. If the plugin cannot be initialized, then the server will fail to start with an error.

      • FORCE_PLUS_PERMANENT - Enables the plugin. If the plugin cannot be initialized, then the server will fail to start with an error. In addition, the plugin cannot be uninstalled with UNINSTALL SONAME or UNINSTALL PLUGIN while the server is running.

  • Command line: --disks=value

  • Data Type: enumerated

  • Default Value: ON

  • Valid Values: OFF, ON, FORCE, FORCE_PLUS_PERMANENT

Uninstalling the Plugin

You can uninstall the plugin dynamically by executing UNINSTALL SONAME or UNINSTALL PLUGIN:

If you installed the plugin by providing the --plugin-load or the --plugin-load-add options in a relevant server option group in an option file, then those options should be removed to prevent the plugin from being loaded the next time the server is restarted.

See Also

This page is licensed: CC BY-SA / Gnu FDL

Last updated

Was this helpful?