Valid for this Ubuntu at least:
$ lsb_release -d
Description: Ubuntu 14.04.1 LTS
I have found that:
$ udisksctl mount --block-device /dev/$device
... will mount /dev/xxx in the same style as automount,
that is - in
/media/$USER/Disk_Label-or-UUID/ with the last level dir auto-created.
$ udisksctl unmount --block-device /dev/$device;
umount the above, but not '-eject' memory card/USB reader content.
$ gvfs-mount --eject "file:///media/$USER/DISK_LABEL"
... lastly appears to be equal to 'Safely remove' or 'Eject' - and that WITHOUT an immediate re-mount.
$ udisksctl power-off --block-device /dev/$device;
... would otherwise be a 'natural' option, but is hampered by an immediate re-mount.
--- you could use this script to "umount all" without having to dig out the names:
for device in $(mount | grep "/media/$USER/" | cut -d" " -f1); do
echo Unmounting $device
udisksctl unmount --block-device $device
if you prefer eject, change the
-f3 in the
cut command and the line with
gvfs-mount --eject "file://$device"
(I think --- you can have problem with correctly quoting labels with blanks in it; and you'll have warnings if the device has multiple partitions mounted).
... will display all the available block devices (except ram disks, no sudo required).
RAM and loop -->
lsblk --all .
How do I "automount" a labelled disk?
Bring up the Dash (hit the 'Super' key) and type 'startup appl' and 'Startup Applications' should appear, click on it.
Click Add and type anything you want in 'Name' and 'Comment' fields. Then fill in 'Command' with your version of:
/bin/bash -c '/bin/sleep 5 && /usr/bin/udisksctl mount -b /dev/disk/by-label/GreenWD_3TB'
/dev/disk/by-label/GreenWD_3TB is anything suitable you find from
the display of
ls -lR /dev/disk/* | less
How to access gvfs mounts from command line?
How to mount drive in /media/userName/ like nautilus does using udisks