Filters
Zo zoek je
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • "twee woorden" vindt precies die zin.
  • --naam of -x vindt een optie.
  • #woord zoekt alleen in commando's.
  • @grep vindt lessen en labs die grep gebruiken.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Zet ! voor een woord om het weg te laten. OR tussen woorden betekent één ervan.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken

udisksctl

Mount, unmount, unlock and power off removable disks as a normal user — the command-line side of the desktop's automount.

Niveau
Extra
Groep
Schijven en bestandssystemen
Root nodig
Nee
Pakket
udisks2

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

Wat het doet

udisksctl talks to the udisks2 service. A user at the local desktop may mount USB sticks, SD cards and ISO files without root; polkit decides what is allowed. Mounts go to /run/media/USER/LABEL. power-off stops the whole device so it is safe to unplug.

It also sets up loop devices for image files and unlocks LUKS-encrypted disks.

Zo schrijf je het

udisksctl COMMAND [OPTION]...

Belangrijkste delen

Commands

status
List the drives and their block devices.
info -b DEV
All details of a device (from udisks).
mount -b DEV
Mount a file system as the user.
unmount -b DEV
Unmount it.
unlock -b DEV / lock -b DEV
Open / close a LUKS encrypted device.
loop-setup -f FILE
Make a loop device for an image file.
loop-delete -b DEV
Remove a loop device.
power-off -b DEV
Stop the drive so it can be removed.
smart-simulate -f FILE -b DEV
Load SMART data from a file (testing).
monitor
Show udisks events live.
dump
Show everything udisks knows.
help
Show help.

Opties 11

Meest gebruikt

Options

-b, --block-device=DEV
The device, for example /dev/sdb1.
-p, --object-path=PATH
The udisks object path instead of a device.
-d, --drive=DRIVE
A drive object (with info).
-t, --filesystem-type=TYPE
File system type for mount.
-o, --options=OPTS
Mount options, for example ro or noexec.
-f, --force
Force the unmount.
--key-file=FILE
Read the LUKS passphrase from a file (unlock).
-f, --file=FILE
The image file (loop-setup, smart-simulate).
-r, --read-only
Read-only loop device.
-o, --offset=BYTES / -s, --size=BYTES
Part of the file for the loop device.
--no-user-interaction
Do not ask for a password (fail instead).

Voorbeelden 10

$ als gewone gebruiker# als root (of met sudo)

  1. 1Show all drives

    udisksctl status
    MODEL                     REVISION  SERIAL               DEVICE
    --------------------------------------------------------------------------
    SanDisk Ultra             1.00      4C530001231022115423 sda
  2. 2Mount a USB stick as a normal user

    udisksctl mount -b /dev/sda1
    Mounted /dev/sda1 at /run/media/student/BACKUP
  3. 3Mount read-only

    udisksctl mount -b /dev/sda1 -o ro
  4. 4Unmount and power off before you unplug it

    udisksctl unmount -b /dev/sda1
    Unmounted /dev/sda1.
    udisksctl power-off -b /dev/sda
  5. 5Open an ISO file without root

    udisksctl loop-setup -r -f ~/Downloads/rhel-10.0-x86_64-dvd.iso
    Mapped file /home/student/Downloads/rhel-10.0-x86_64-dvd.iso as /dev/loop0.
    udisksctl mount -b /dev/loop0
    udisksctl unmount -b /dev/loop0
    udisksctl loop-delete -b /dev/loop0
  6. 6Unlock an encrypted USB disk

    udisksctl unlock -b /dev/sdb1
    Passphrase:
    Unlocked /dev/sdb1 as /dev/dm-3.
    udisksctl mount -b /dev/dm-3
  7. 7Lock it again after use

    udisksctl unmount -b /dev/dm-3
    udisksctl lock -b /dev/sdb1
  8. 8Details of a device

    udisksctl info -b /dev/sda1 | grep -E 'IdLabel|IdType|Size'
  9. 9Watch what happens when you plug a device in

    udisksctl monitor
  10. 10Use it in a script without password prompts

    udisksctl mount -b /dev/sda1 --no-user-interaction || echo "not allowed"

Let op

  • Over SSH, polkit normally does not allow normal users to mount; use sudo mount there.
  • power-off works on the whole disk (/dev/sda), not on a partition.

Bestanden

/run/media/USER/
Where udisks mounts devices for a user.
/etc/udisks2/
Settings of udisks2.

Tips om te onthouden

  • lsblk -f first: it shows the label and file system of every partition.

Exitcodes

0Success.
1Error (not allowed, busy, not found).

Volledige handleiding

Deze pagina legt het commando uit in eenvoudige woorden. De originele handleiding heeft elk detail.

In je terminal: man udisksctl