Udisksctl Command Line Tool
Linux Disk Management with Udisksctl
The udisksctl command line tool provides a powerful and user-friendly interface for managing storage devices in Linux. It allows users to perform various operations on block devices, partitions, and loop devices without needing to directly interact with lower-level system utilities. This guide covers essential udisksctl commands for everyday disk management tasks.
Udisksctl Command Examples
Below are common usage examples for the udisksctl command:
Displaying Block Device Information
To output low-level information for a specific block device and its partitions, use the info command:
udisksctl info -b /dev/sdd1
Mounting Partitions
Mount a partition on the given block device. By default, it uses /media and often doesn't require root privileges on typical systems.
udisksctl mount -b /dev/sd??
Setting Up Loop Devices
Set up a loop device using an image file. This command only sets up the device; you will likely need to mount it afterward. The device is often /dev/loopX.
udisksctl loop-setup -f image file
Deleting Loop Devices
Delete a loop device. Note that this command does not delete the associated image file. Ensure all filesystems on the device are unmounted first.
udisksctl loop-delete -b /dev/loop0
Powering Off Block Devices
Power off a block device. This functionality may vary depending on the device.
udisksctl power-off -b /dev/sdb
Advanced Mounting Options
An example of a suitable mount request for auto-mounting at startup, useful if fstab is not configured correctly. This demonstrates using mount-style options.
udisksctl mount --no-user-interaction --options noatime -b /dev/sde1
Resolving User Mounting Permissions
In some Linux distributions, like Ubuntu 18.04, regular users might not have permissions to mount filesystems with udisksctl without root access. This can be resolved by installing the appropriate PolicyKit package.
sudo apt-get install policykit-desktop-privileges