How can I tell which device the USB drive is assigned as?
Before inserting the USB drive:
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
nvme0n1 259:0 0 238.5G 0 disk
├─nvme0n1p5 259:3 0 15.9G 0 part [SWAP]
├─nvme0n1p1 259:1 0 222.6G 0 part /
└─nvme0n1p2 259:2 0 1K 0 part
After:
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 1 1.9G 0 disk
├─sda2 8:2 1 2.4M 0 part
└─sda1 8:1 1 1.2G 0 part
nvme0n1 259:0 0 238.5G 0 disk
├─nvme0n1p5 259:3 0 15.9G 0 part [SWAP]
├─nvme0n1p1 259:1 0 222.6G 0 part /
└─nvme0n1p2 259:2 0 1K 0 part
Is it /dev/sda
??
Simply use
lsblk
output options to find it out:which produces:
You can also use other options to get extra information (e.g: SIZE).
If you want a nice clean output use
-S
:How to find out which of your devices is a usb device
In short:
Or, on a specific device:
If it has any output,
sda
is a usb device.Long version
Information on your devices is to be found in the directory
/dev/disk
. Specifically the sub directories/dev/disk/by-id
and/dev/disk/by-path
give us information on wheter a device is a usb device or not. For example a name like:makes clear this is a usb drive.
If I run
ls -l
on the file, the output is:which clearly shows this is
sdb
Using find to filter out usb devices
The
find ... -ls
command, will subsequently give us the information we need.You can easily find out which of the devices is a usb device by running the command:
To check if specifically
sda
is a usb device, run:If it has any output, it is a usb device.
It obviously looks like your usb device has two partitions:
Look at the syslog (
/var/log/syslog
) anddmesg
right after connecting the USB should show messages about what/dev/sXY
device it is, or if it had any problems and didn't get a/dev/sXY
name.Looking at
lsblk
should match it by size, if it successfully got a /dev/ name and you're sure there are no other similar sized devices attached.Another option is looking at the output of
blkid
(optionally executed as root, i.e. assudo blkid
). This will give you the opportunity to match your device not only by size but also by file system and/or partition label. Especially the partion label can be quite helpful.Going by the output from
lsblk
you posted, it is quite obvious that your USB device actually issda
. You have one block device, then you connect your USB device, and it now shows two devices. So, obviously, the additional device appeared upon plugging in your USB device, so it should be the same device.