knowledge/technology/linux/udisks.md
2025-06-26 08:17:03 +02:00

5.3 KiB

obj arch-wiki website repo
application https://wiki.archlinux.org/title/Udisks https://www.freedesktop.org/wiki/Software/udisks https://github.com/storaged-project/udisks

udisks

udisks provides a daemon udisksd, that implements D-Bus interfaces used to query and manipulate storage devices, and a command-line tool udisksctl, used to query and use the daemon.

Configuration

Permissions

Actions a user can perform using udisks are restricted with polkit. If the user session is not activated or present (for example, when controlling udisks from a systemd/User service), adjust polkit rules accordingly.

See https://github.com/coldfix/udiskie/wiki/Permissions for common udisks permissions for the storage group.

Default mount options

It is possible to define default mount options in /etc/udisks2/mount_options.conf. Create the file if it does not already exist. The built-in defaults and some examples can be seen in /etc/udisks2/mount_options.conf.example.

The options can target specific filesystem types. For example, mount btrfs filesystems with zstd compression enabled:

# /etc/udisks2/mount_options.conf
[defaults]
btrfs_defaults=compress=zstd

Note

: Lines override the corresponding built-in defaults. Make sure not to accidentally remove mount options this way.

Usage

Information

Show information about an object.

Usage: udisksctl info [OPTION …]

Option Description
-p, --object-path Object to get information about
-b, --block-device Block device to get information about
-d, --drive Drive to get information about

To show info on all elements: udisksctl dump

For a high-level status: udisksctl status

To monitor for changes: udisksctl monitor

Mounting

Mount a filesystem.

Usage: udisksctl mount [OPTION …]

Option Description
-p, --object-path Object to get information about
-b, --block-device Block device to get information about
-t, --filesystem-type Filesystem type to use
-o, --options Mount options
--no-user-interaction Do not authenticate the user if needed

Unmount a filesystem.

Usage: udisksctl unmount [OPTION …]

Option Description
-p, --object-path Object to get information about
-b, --block-device Block device to get information about
-f, --force Force/lazy unmount
--no-user-interaction Do not authenticate the user if needed

Encryption

Unlock an encrypted device.

Usage: udisksctl unlock [OPTION …]

Option Description
-p, --object-path Object to get information about
-b, --block-device Block device to get information about
--no-user-interaction Do not authenticate the user if needed
--key-file Keyfile for unlocking
--read-only Unlock the device as read-only

Lock an encrypted device.

Usage: udisksctl lock [OPTION …]

Option Description
-p, --object-path Object to get information about
-b, --block-device Block device to get information about
--no-user-interaction Do not authenticate the user if needed

Loop Devices

Set up a loop device.

Usage: udisksctl loop-setup [OPTION …]

Option Description
-f, --file File to set-up a loop device for
-r, --read-only Setup read-only device
-o, --offset Start at <num> bytes into file
-s, --size Limit size to <num> bytes
--no-partition-scan Do not scan the loop device for partitions
--no-user-interaction Do not authenticate the user if needed

Delete a loop device.

Usage: udisksctl loop-delete [OPTION …]

Option Description
-p, --object-path Object to get information about
-b, --block-device Block device to get information about
--no-user-interaction Do not authenticate the user if needed

Power Off

Safely power off a drive.

Usage: udisksctl power-off [OPTION …]

Option Description
-p, --object-path Object to get information about
-b, --block-device Block device to get information about
--no-user-interaction Do not authenticate the user if needed