Removable media

Mounting removable media, like CDs, DVDs, USB drives or memory cards, needs special handling if a regular user wants to be able to mount an unknown device.

Prerequisites

 * Kernel support for the storage device.
 * Kernel support for the filesystem.

UUIDs and labels
In many cases storage devices are identified by their device file, e.g. . Alternatively their UUID (Universally Unique Identifier) or label  can be used. In comparison to device files UUIDs and labels are persistent and will never change because of asynchronous detection. The UUID is generated automatically during filesystem creation. The label can be specified at filesystem creation or changed afterwards.

Use or  (part of ) to show all storage devices and their UUIDs and labels:

Mounting removable media
For mounting as a normal user without root privileges the device needs an entry with the option in fstab.

Plug removable media to the computer then run or.

The and  lines display the UUIDs  and  to be added to  for two media just plugged-in. also has the label which could be used. Let's create their mountpoints "larry1" and "larry2"

And add them in.

With the option in these entries, they can be mounted / unmounted by normal users.

To see what is mounted, run without arguments or  again and find the  column populated for sdb1 and sdc1:

For unmounting the usage of mountpoint, label or uuid is equivalent as is for mounting. Any of them will do it.

Mounting without the fstab entry can be done by root only.

For further details see.

Once the device is connected and mounted it can be accessed like a normal hard disk. Usual operations like, , , etc. work fine. If one does not already exist, a filesystem can be created on the device.

MTP
For handling media using the MTP (Media Transfer Protocol) protocol see the MTP article.

External resources

 * https://wiki.debian.org/Part-UUID
 * http://en.wikipedia.org/wiki/Universally%20unique%20identifier