How do I figure out which /dev is a USB flash drive?

Easiest way: Look at the output of dmesg after connecting the USB device. It should show you what /dev node was assigned to it.


As long as you are running udev, you can do this easily by referencing /dev/disk/by-id/usb-manufacturername_serialnumber. These appear as symbolic links which you can either directly reference within your fstab, or which you can dereference using readlink -e to determine the associated block device.

Here's a real world example. On my machine, I have 3 USB hard drives connected. These each show up in /dev/disk/by-id with unique serial numbers (although they share a common manufacturer string). I have created symbolic links to each of these three unique entries, and can now quickly determine which drive is which (and which device is associated with each drive) by running readlink -e linkname. For example, running readlink -e /root/disk2 on my machine currently displays "/dev/sde", while readlink -e /root/disk3 produces no output whatsoever.


All of these are good suggestions, but the quickest and least verbose method is to just type the following in the terminal:

mount

which will give a list of all the mounted devices (this assumes the USB drive is mounted, which is usually the case with modern Linux distros).

Tags:

Linux

Usb