I need to list all mount points associates to external storage devices such as USB keyfobs and SATA external drives.

The only way I found under Ubuntu, is to call 'mount' and grep for '/media'. But I wonder if there is a better, more universal way.

All this from the command line interface (terminal/bash).

2 Answers 2


Looking in /media is a reasonable way to find hotplug block devices. You can also use lsblk to list the block devices and whether they are hotpluggable:

$ lsblk -l -p -o name,rm,hotplug,mountpoint
/dev/sda   0       0 
/dev/sda1  0       0 /
/dev/sda2  0       0 [SWAP]
/dev/sda3  0       0 /home
/dev/sdc   0       1 
/dev/sdc1  0       1 
/dev/sdc2  0       1 
/dev/sdc3  0       1 /media/wd3
/dev/sdc4  0       1 
/dev/sdd   1       1 
/dev/sdd1  1       1 /media/clip

This shows that /dev/sdc is probably an external device (HOTPLUG=1), and that a partition is mounted on /media/wd3. Also there's another device on /media/clip. The RM column means removable, which sometimes applies to sd card readers, though in this case it is actually just a usb flash key.

You can also use findmnt to get from a directory name to the name of the device it is on:

$ findmnt -n -o source -T /media/wd3/my/sub/dir
  • Darn, I get this on Ubuntu 14.04 Trusty Thar LTS: # lsblk -l -o name,rm,hotplug,mountpoint lsblk: unknown column: hotplug,mountpoint Option -p is not available either. lsblk is part of the util-linux package and Ubuntu 14.04 comes with version 2.20.1-5.1ubuntu20.7. For the moment, I hesitate selecting your answer, but I am tempted since in theory, it is exactly what I am looking for. What OS are you using and more particularly, what version of lsblk? May 22, 2016 at 9:34
  • @HansDeragon my lsblk is version 2.26.2, on fedora 22. I think it might be finding the hotplug info from /sys but it isn't obvious where as there is no pseudo file hotplug whereas there is a /sys/block/sdd/removable file which holds 1.
    – meuh
    May 22, 2016 at 10:11
  • Accepted as a solution. I upgraded to Ubuntu 16.04 LTS Xenial Xerus, and it comes with util-linux 2.27.1-6ubuntu3. lsblk does the job. Jun 8, 2016 at 21:24

There is no difference between internal and external devices, so no, there's no better way than to hope mounting has been consistent enough that all external devices (and only those) are mounted under /media. But a user with the right permissions can easily mount e.g. an USB stick anywhere.

  • So this is how GUI file manager detect external devices? By looking only under /media? I ask because they seam to do a good job. May 21, 2016 at 7:37
  • I guess nowadays they use DBus and the org.freedesktop.UDisks.EnumerateDevices method and/or listen to the org.freedesktop.UDisks.DeviceAdded signal.
    – BlackJack
    Jun 14, 2018 at 13:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .