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.
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 or :
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 or the options. This can be provided as a command-line argument to or specified in a relevant server in an :
After the plugin is installed, the INFORMATION_SCHEMA.DISKS table displays disk utilization information.
To view disk usage information, run the following query:
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).
Note: As root users may have more available space than non-root users,
Available+Usedmay be less thanTotal.Additionally, all paths to which a specific disk is mounted are reported, so a disk may appear multiple times in the output.
As an alternative option, the plugin includes the INFORMATION_SCHEMA.MOUNTS table, which contains mount points and their respective disks.
For example:
disksDescription: 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 table.
You can uninstall the plugin dynamically by executing or :
If you installed the plugin by providing the or the options in a relevant server in an , then those options should be removed to prevent the plugin from being loaded the next time the server is restarted.
This page is licensed: CC BY-SA / Gnu FDL
Available: The amount of disk space available to non-root users (in KiB).
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.
See Plugin Overview: Configuring Plugin Activation at Server Startup for more information.
Command line: --disks=value
Data Type: enumerated
Default Value: ON
Valid Values: OFF, ON, FORCE, FORCE_PLUS_PERMANENT
1.1
Stable
, , ,
1.0
Beta
, ,
INSTALL SONAME 'disks';[mariadb]
...
plugin_load_add = disksSELECT * FROM information_schema.DISKS; +-----------+-----------------------+-----------+----------+-----------+
| Disk | Path | Total | Used | Available |
+-----------+-----------------------+-----------+----------+-----------+
| /dev/sda3 | / | 47929956 | 30666304 | 14805864 |
| /dev/sda1 | /boot/efi | 191551 | 3461 | 188090 |
| /dev/sda4 | /home | 174679768 | 80335392 | 85448120 |
| /dev/sdb1 | /mnt/hdd | 961301832 | 83764 | 912363644 |
| /dev/sdb1 | /home/wikman/Music | 961301832 | 83764 | 912363644 |
| /dev/sdb1 | /home/wikman/Videos | 961301832 | 83764 | 912363644 |
| /dev/sdb1 | /home/wikman/hdd | 961301832 | 83764 | 912363644 |
| /dev/sdb1 | /home/wikman/Pictures | 961301832 | 83764 | 912363644 |
| /dev/sda3 | /var/lib/docker/aufs | 47929956 | 30666304 | 14805864 |
+-----------+-----------------------+-----------+----------+-----------+
9 rows in set (0.00 sec)SELECT * FROM information_schema.MOUNTS; +-----------------------+-----------+
| Path | Disk |
+-----------------------+-----------+
| / | /dev/sda3 |
| /boot/efi | /dev/sda1 |
| /home | /dev/sda4 |
| /mnt/hdd | /dev/sdb1 |
| /home/wikman/Music | /dev/sdb1 |
+-----------------------+-----------+UNINSTALL SONAME 'disks';