Sunday, April 9, 2017

udisksctl

For most users these days, accessing flash drives in Linux is handled nicely by the desktop and file managers. But sometimes it's convenient to be able to mount a flash drive from the command line, as a normal user; for that, try the udisksctl tool.

I tested this in Antergos, in Debian Stable ("Jessie"), and in Debian Testing ("Stretch"). Insert the flash drive and run lsblk to check for the device name:


sdb1 is the device name for my flash drive. To mount it, I used:

$ udisksctl mount -b /dev/sdb1


The -b switch is short for --block-device, according to udisksctl mount --help.

Running lsblk again shows the flash drive mounted:


To unmount the flash drive, I used:

$ udisksctl unmount -b /dev/sdb1



For more info see man udisksctl, udisksctl help, udisksctl mount --help, and these excellent articles:

https://zeth.net/2014/05/28/modern_mounting_with_udisks2.html

https://people.freedesktop.org/~david/udisks2-20110628/udisksctl.1.html

https://wiki.archlinux.org/index.php/Udisks

No comments: