5

I'm on Ubuntu Mate 16.04. I would like someone to give me a short introduction to the basic usage of the udisks utility on Linux systems. Specifically, I would like to know how to properly mount and unmount an external USB drive.

misha
  • 952

1 Answers1

6

To see connected devices do

lsblk

Identify the device you want to mount or unmount. USB devices will mount in /media so after you connect them you can identify them by their mountpoints. We can see the mounted device here is /dev/sda1

NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda            8:0    1 15.2G  0 disk 
└─sda1         8:1    1 15.2G  0 part /media/zanna/4C45-110F

to unmount this device:

udisksctl unmount -b /dev/sda1

-b stands for block device. After entering this command lsblk shows:

NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda            8:0    1 15.2G  0 disk 
└─sda1         8:1    1 15.2G  0 part 

Now it's safe to remove. To re-mount it:

udisksctl mount -b /dev/sda1

For general help type udisksctl help and for help on each command, type it and add --help for example:

udisksctl info --help

For information about my root partition I would type

udisksctl info -b /dev/mmcblk0p2

For more information type info udisksctl

Zanna
  • 70,465
  • 1
    I’d prefer a non-sudo alternative to the first command (not all users can use sudo), for example lsblk. – Melebius Jul 14 '16 at 13:35
  • @Melebius thanks a lot for the super helpful comment - lsblk is much better for this :D – Zanna Jul 14 '16 at 13:37