How do I figure out which /dev is a USB flash drive?
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Cool Puzzler LoFi
--
Chapters
00:00 How Do I Figure Out Which /Dev Is A Usb Flash Drive?
00:48 Accepted Answer Score 95
01:02 Answer 2 Score 29
01:59 Answer 3 Score 57
02:47 Answer 4 Score 63
03:06 Thank you
--
Full question
https://superuser.com/questions/361885/h...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#linux #usb
#avk47
ACCEPTED ANSWER
Score 95
Easiest way: Look at the output of dmesg
after connecting the USB device. It should show you what /dev
node was assigned to it.
ANSWER 2
Score 63
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).
ANSWER 3
Score 57
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.
ANSWER 4
Score 29
Try the command udevinfo -q all -n /dev/sda
, where /dev/sda
is the path to your disk. This gives you a boatload of info about the disk you're looking at - there's an entry that tells you about the bus it's connected to.
This of course saves you from having to grep through dmesg and/or logs.
Update
udevadm info --query=all -n /dev/sda
From at least Jul 2010 [1] udevinfo
was substituted in Debian (and derived) by udevadm info
with a little transient with which there were symlinks soon deprecated and removed (you can still found them in old not updated machine). Always from [1] we can read:
In udev 117,
udevadm
was introduced andudevinfo
and other programs turned into compatibility symlinks. The symlinks were deprecated in udev 128 and removed for good in udev 147.