UDisks is a service and library for managing disks and storage devices on GNU/Linux systems. It uses D-Bus as its communication interface and is designed to simplify detection, mounting, unmounting, formatting, and monitoring of hard drives, SSDs, USB sticks, and other volumes—for both users and graphical applications. It is widely used in desktop environments like GNOME, working alongside tools such as udisks2, gvfs, and GNOME Disks (gnome-disk-utility).
What is UDisks?
UDisks (formerly DeviceKit-disks) is a user-space service on Linux that provides a unified API for managing storage devices. Since version 2 (known as udisks2), it has become a core component of many modern Linux distributions, enabling tools like Nautilus or GNOME Disks to access, mount, format, or manage partitions safely.
Unlike system daemons such as udevd
, UDisks serves as an abstraction layer, allowing other applications to interact with storage hardware in a consistent and secure way.
UDisks Architecture
UDisks is composed of three main components:
- The
udisksd
daemon
A background service that communicates over D-Bus. It provides the actual methods used for mounting, unmounting, formatting, or resizing partitions. - The command-line utility
udisksctl
Allows users and integrators to interact withudisksd
directly from the terminal. Common commands includemount
,unmount
,power-off
,status
, andsmart-status
. - The
libudisks2
library
Enables developers to integrate UDisks functionality into their own applications.
Key Features
UDisks supports a wide range of operations, both automatic and manual, including:
- Auto-mounting volumes
When a USB drive or external disk is plugged in,udisksd
detects it and can automatically mount it (depending on desktop environment settings and policy rules). - Partition creation and management
It allows creating, resizing, and deleting partitions using either command-line tools or graphical interfaces built on top of UDisks. - Filesystem formatting
Supports formatting to various file systems (ext4, NTFS, FAT, exFAT, etc.), assuming the necessary tools are installed. - SMART health monitoring
UDisks can access SMART data from hard drives and SSDs using tools likesmartctl
, helping users monitor disk health. - LUKS encryption support
Users can create, unlock, and manage encrypted volumes with LUKS through the UDisks API or CLI, integrated withcryptsetup
. - Safe device ejection
External USB drives or disks can be unmounted and powered off safely (udisksctl power-off -b /dev/sdX
).
Practical Usage with udisksctl
Here are some practical examples using the command-line interface:
- Mount a device:
udisksctl mount -b /dev/sdb1
- Unmount a device:
udisksctl unmount -b /dev/sdb1
- Power off a USB drive: b
udisksctl power-off -b /dev/sdb
- Check SMART status:
udisksctl smart-status -b /dev/sda
These commands may require root privileges (via sudo
) depending on the system’s polkit
configuration.
Desktop Environment Integration
UDisks integrates seamlessly with modern desktop environments such as GNOME, KDE Plasma (via Solid), and Xfce. File managers like Nautilus, Thunar, or Dolphin use UDisks as a backend to handle device mounting and display storage information.
For example, GNOME Disks (package gnome-disk-utility
) lets users partition, benchmark, manage boot settings, and perform SMART analysis using UDisks as its backend.
Security and polkit
UDisks leverages polkit (formerly PolicyKit) to define which users can perform actions on devices. This allows:
- Regular users to mount external drives.
- Restriction of actions like formatting to admin users only.
- Custom rules based on user groups, device types, or other criteria.
Example polkit rule to allow mounting without password:
/etc/polkit-1/rules.d/10-udisks.rules
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.udisks2.filesystem-mount" &&
subject.isInGroup("plugdev")) {
return polkit.Result.YES;
}
});
Comparison with Other Tools
Tool | Main Use | GUI Required | D-Bus Based |
---|---|---|---|
udisksctl | Mounting, unmounting, powering off devices | No | Yes |
mount , umount | Traditional UNIX utilities | No | No |
gnome-disks | Graphical disk and partition management | Yes | Yes |
lsblk , blkid | Display storage information | No | No |
parted , gparted | Manual/graphical partitioning | Optional | No |
UDisks offers a more modern experience, especially in desktop contexts, with policy-driven access control and better integration with modern tools.
Conclusion
UDisks has evolved into a critical component for modern Linux storage management. Its D-Bus-based architecture, security policy integration via polkit, and desktop environment compatibility make it ideal for both novice users and experienced system administrators. While not a replacement for classic tools like fdisk
or mount
, UDisks provides a more secure, consistent, and developer-friendly abstraction layer for managing storage.
For developers, integrators, and everyday users, mastering UDisks is essential for secure, efficient, and automated storage workflows on Linux.