If you use Linux daily, sooner or later you're going to have to. find out what your USB drive is called within the systemAnd no, I'm not referring to the pretty name you see on the desktop, but to the famous one. / Dev / sd that you need to assemble it by hand, record an image or change the label without accidentally damaging another disc.
Sometimes the graphical environment does its job and mounts the USB drive without complaint, but on other occasions (especially on certain desktops like KDE(peculiar configurations or rescue situations) it's time to pull out the terminal and play detective. In this article we'll see, in detail, How to correctly detect the name of your USB drive in Linux and avoid selecting the wrong deviceas well as how to change the label and some extra tricks that will come in handy.
Why is it so important to properly identify your USB drive?
In Linux, each storage device is represented by a file in / DevAnd that's where the confusion begins: /dev/sda, /dev/sdb, /dev/sdc…each with its partitions /dev/sda1, /dev/sdb1etc. If you make a mistake and, for example, record an image over / Dev / sda By thinking it's the USB drive when it's actually your hard drive, you've signed the death warrant for your data.
Therefore, before assembling anything, formatting, or burning an ISO, it is essential Identify with complete certainty which device corresponds to your USB memory stick.We will rely on several tools: from low-level commands such as sg_map o sg_scan...to more user-friendly utilities such as mount, lsusb, fdisk -l or even graphical applications such as G-CPU that help you see everything at a glance.
Detect if the USB drive is recognized by the system
The first thing is to find out if the operating system, at least, It sees the USB device when you connect itBefore we get into /dev names, check that the kernel detects it as a physical device.
A very convenient tool for this first step is the command lsusbThis command lists all the USB devices currently connected to the system. In a typical scenario, after connecting your USB drive, you might see something like this:
Bus 003 Device 002: ID 13fe:1d00 Kingston Technology Company Inc. DataTraveler 2.0 1GB Flash Drive
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000
In this case, lsusb clearly lists a Kingston DataTraveler memory stick, with its manufacturer and product identifier. This tells us that the USB port and the device are seeing each other, even though the desktop (for example, KDE) don't mount it automatically, which it may be doing GNOME or similar environments.
This same method works great not only for USB drives, but also for USB modems, card readers, etc.If nothing new appears in lsusb When you connect the USB drive, you know the problem is one of physical detection or hardware, and not of device names.
Use sg3-utils to map the USB drive to a /dev device
When the graphical environment doesn't mount the USB drive but the system does see it, it's time to move on to more technical tools. One of the most comprehensive ways to find out how Linux identifies your drive is by using the package sg3-utilswhich includes utilities for handling generic SCSI devices (which, in practice, also includes many USB storage devices).
First you will have to install sg3-utils If you don't already have it in your Debian/Ubuntu-based distribution:
sudo apt-get install sg3-utils
Once installed, the command sg_map It shows you the mapping between generic SCSI devices /dev/sgX and typical block devices such as / Dev / sda, / Dev / sdbetc. For example:
/dev/sg0 /dev/sda
/dev/sg1 /dev/scd0
/dev/sg2 /dev/scd1
At this point, the interesting thing is to repeat the procedure. before and after connecting the USB driveFirst you run sg_map Without the USB, you note the result, then connect the USB drive and run again:
sg_map
/dev/sg0 /dev/sda
/dev/sg1 /dev/scd0
/dev/sg2 /dev/scd1
/dev/sg3 /dev/sdb
Now you can clearly see that a new entry has appeared: /dev/sg3 /dev/sdbComparing this to the previous output, you know that That new line corresponds to the USB drive you just inserted.so the associated block device will be / Dev / sdb.
If you want more details, you can use sg_scan -iwhich expands the information for each SCSI device:
/dev/sg3: scsi2 channel=0 id=0 lun=0
Kingston DataTraveler 2.0 PMAP
Thanks to this exit you know that the /dev/sg3 is your Kingston DataTravelerAnd from the previous mapping you have already seen that it is associated with / Dev / sdbNow we need to locate its main partition, which will normally be / dev / sdb1although ideally it should be confirmed with other commands.
Check the latest kernel messages with dmesg

Another very practical way to check how the system has detected your USB drive is to check the kernel message log right after connecting it. The classic method is used for this:
dmesg | tail
This command shows you the last lines of the log, where messages like the following usually appear:
sd 3:0:0:0: 8060928 512-byte hardware sectors (4127 MB)
sd 3:0:0:0: Write Protect is off
sdb: sdb1
sd 3:0:0:0: Attached SCSI removable disk
sd 3:0:0:0: Attached scsi generic sg3 type 0
Here you can see that the kernel has detected a new disk and, most importantly, a partition sdb1This means that the device we are interested in assembling or manipulating will normally be / dev / sdb1not the whole album / Dev / sdbunless you are going to perform very low-level operations (such as dumping an image onto the entire device).
The message Attached SCSI removable disk confirms that it is a removable disk (a USB drive or similar), and the line that mentions sg3 This fits with what we've seen when using the utilities of sg3-utilsCross-referencing this information gives you a fairly high degree of certainty that you're not choosing the wrong device.
Mounting the USB drive manually in Linux
Once you know the name of the partition on your USB drive, the logical next step is Install it to access its contentFollowing the previous example, if we have determined that it is / dev / sdb1It will be enough to create (if it doesn't already exist) a mount point and use the command mount.
Imagine you want to mount it on /media/usbYou could do it like this:
sudo mkdir -p /media/usb
sudo mount /dev/sdb1 /media/usb
The general syntax of the command is very simple: mount device path_where_to_mountFrom this moment on, You can now browse the contents of the USB drive by entering /media/usb from the file manager or the terminal itself.
In most modern distributions you won't have to do this manually, because desktop environments usually detect and mount the USB drive automatically. However, If something goes wrong with the graphics layer or you're working in console modeThese steps guarantee you access to your data as long as the hardware is working properly.
Finding your USB drive in the directory tree
It can happen, a very common occurrence when starting out with Linux, that you connect the USB drive and I have no idea where the hell the system put it.I have no idea if it's in /half, /run/media or in some route with the username.
On many desktops, when you click on the memory stick, an icon appears in the side panel of the file manager, and below it, You see the name of the device being used as a labelIf you right-click and look at the properties, it will usually also show you the mount path, something like /media/USER/PENDRIVE_NAME.
If you prefer the command line, there's a very simple technique: Connect the USB drive, wait for it to mount automatically, and then run the mount command. filtering by the name of the associated folder. For example, if on the desktop you see it appear as DISK_IMGYou can do:
mount | grep DISK_IMG
The output will look something like this:
/dev/sdb1 on /media/USUARIO/DISK_IMG type vfat (...)
This way you know at the same time which is the actual device (/dev/sdb1) y where it is mounted (/media/USER/DISK_IMGIf you don't have many devices connected, another option is to simply run mount and manually review the list until you find your memory, but with grep You've narrowed down the search considerably.
List disks and partitions with fdisk -l
A very classic and effective way to locate your USB drive is to use fdisk -lThis command lists all disks and partitions detected by the system. However, it must be run as administrator, as it displays low-level information.
The typical use would be:
sudo fdisk -l
The output you'll get may be long, but the important thing is pay attention to the size and type of partition and, for advanced diagnosis, the disk monitoring and SMARTFor example, if you have a 500 GB hard drive and suddenly you see a device /dev/sdd with a single partition /dev/sdd1 8 GB in format FAT32, most likely, That's your USB drive..
Many users rely on this when they have multiple internal and external drives connected. See the size, file system (FAT32, exFAT, NTFS, etc.) and label This helps avoid confusion. Sometimes, the USB drive will be the only drive formatted as FAT32, making identification even easier.
Change the name (label) of your USB drive from the terminal
Once you have located the correct partition, you may be interested in give it an identifying name To know at all times which USB drive you have connected. This is especially useful if you manage several USB drives and want to differentiate them without going crazy.
There are several ways to change the label in Linux. One of the simplest with FAT file systems is the command twofslabelRemember that you will need administrator privileges and it is highly recommended to do this with the USB drive removed to avoid mistakes.
Assuming your memory is /dev/sdd1You could rename it like this:
sudo dosfslabel /dev/sdd1 COZORELLO
In this example, COZORELLO is the new name for the USB driveYou must replace /dev/sdd1 by the actual partition of your device and, of course, choose whatever label you like. However, there are some typical limitations of these file systems:
- Accents and most special symbols are not allowed..
- The name is usually limited to 11 charactersIf you go too far, it gets cut off.
- In some cases lowercase letters are not acceptedTherefore, it is safer to use capital letters to avoid problems.
If you make the change while the USB drive is mounted, the command might not work. return some errorHowever, when you remove and reconnect the memory, it usually appears with the new label. Even so, the recommended practice is always disassemble the device before renaming it.
Rename the USB drive using mtools and mlabel
Another very interesting alternative for change the label on your USB drive It's the package mtools, originally designed to handle MS-DOS type file systems without needing to mount them, but still very useful for these tasks.
To begin, you'll need to install it using your package manager. On Debian/Ubuntu, this is done as follows:
sudo aptitude install mtools
Once installed, there is a small setup step: Copy the mtools.conf file to your home folder and rename it as .mtoolsrc so that it remains hidden. For example, if your username is user:
cp /etc/mtools.conf /home/usuario/.mtoolsrc
Then you will have to edit the .mtoolsrc file with your favorite editor, for example:
gedit /home/usuario/.mtoolsrc
Add the following instruction to the first line of the file:
mtools_skip_check=1
This tells mtools that skips certain preliminary checksThis avoids unnecessary warnings when working with removable devices. From here, you can start playing around with mlabel, which is the tool that manages the tags.
The next step is to double-check which device you have. You can use sudo fdisk-l to locate again, for example, that your memory is in / dev / sdf1As an additional security measure, it is advisable Check the current label before changing it:
sudo mlabel -i /dev/sdf1 -s ::
This will display something like the current label on the USB drive. Once you've verified that you haven't selected the wrong device, you can assign a new one.
sudo mlabel -i /dev/sdf1 ::PenDrive
After running the command, you can double-check it with:
sudo mlabel -i /dev/sdf1 -s ::
This way you ensure that The name has been changed correctlyFrom then on, every time the system mounts the device, it will use the new label (PenDrive in this case)And you'll find it much easier to identify it at a glance, both on the desktop and in the partition listings.
Use graphical tools like CPU-G to identify the USB

If you don't feel like constantly battling with the command line, there are also graphical applications that clearly show what device each thing isA curious example is G-CPU, a system information tool similar to CPU-Z, which includes a tab called Discs where you can see the storage devices and their partitions.
This tab lists the different mounted partitionsindicating his device name (/dev/sdXn), mount point, capacity, and usageAt a glance you can tell Which partition corresponds to the USB drive and where is it mounted?This greatly reduces the risk of confusion when recording images or formatting.
In addition to this, CPU-G offers additional information, such as the battery status In laptops (voltage, charging, design, current, etc.), this data allows you to know if it's deteriorating and when it's time to start thinking about replacing it. In desktop computers, where there's no battery, the latest versions have corrected errors so that, simply, the corresponding tab does not appear and no errors occur.
Similarly, problems obtaining the Xorg version On certain systems, this improves the overall stability of the application. To install CPU-G on Ubuntu, you can use a specific PPA:
sudo add-apt-repository ppa:atareao/atareao
sudo apt update
sudo apt install cpu-g
Once installed, simply open it and check the tab for Discs to visually locate your USB drive and see its actual path in /dev without needing to remember commands.
Real-life situations: when the USB drive doesn't appear
In practice, one of the most frequent scenarios is that of the user who comes from Windows, brings a text file with links on a USB driveHe plugs it into his new Linux computer and suddenly can't see the memory anywhere.
In distributions like POP!_OS on System76 systemsThe general procedure should be that the USB drive mounts automatically and appears in the file manager's sidebar. But if you don't see it, there are several things you can check: lsusb to determine if the hardware is recognized, dmesg | tail to see what the kernel says right after connecting it, and fdisk -l o lsblk to check if a new block device has been detected; and if you need more information, see essential diagnostic tools.
If the system recognizes the USB drive but it is not mounted, You can assemble it manually. With the steps we have seen, choosing a mounting point as /media/usb or similar. If it doesn't appear in either lsusb nor in the kernel messages, so the problem points more to a physical failure in the memory or USB port than Linux itself.
When the USB drive is physically damaged
Not every time a USB drive fails is it the operating system's fault. Sometimes, it's simply... The device has a physical problem.A typical example is that of a USB 3.0 memory that shows no sign of life when connected and whose contents must be recovered at all costs.
In these cases, a forensic analyst or specialized technician usually begins physically disassembling the USB drive, carefully removing the casing (they are often glued with epoxy resins) until you can access the internal board and the USB connector.
Examining the plate may reveal unpleasant surprises, such as the USB 3.0 bus connection pins (the blue ones) are literally broken or unsolderedIf the parts that should be physically joined are separated, the device is unable to establish communication with the computer's USB port.
In such a scenario, the only reasonable way to attempt to recover the information It involves repairing the hardware: resoldering the traces, replacing the connector, or, in extreme cases, transplant the memory chip to another compatible boardThis goes beyond the normal use that a home user might give it and enters fully into the realm of the laboratory and fine electronics.
Therefore, if you've tried all the software tools (lsusb, dmesg, fdisk, manual mounts, etc.) and the USB drive still appears as if it doesn't exist, there's a good chance that the failure is physical and not logicalTherefore, it might be a good idea to consult a professional if the data is truly important.
As you have seen, Linux offers a fairly wide range of tools for Identify the name of your USB drive without making a mistake, check if the system recognizes it, mount it manually, and even change the label. to have everything better organized. From commands like sg_map, sg_scan, dmesg, lsusb, fdisk -l, mount or mlabel...even graphical utilities such as G-CPUYou have plenty of resources—including guides for cloning and restoration of disks and USB drives— to deal with both a simple rogue USB drive and configurations with several disks and memories in parallel; and when it still doesn't appear, that's when it's advisable to start suspecting that the problem is already in the memory hardware itself and not in your Linux.