Mounting a USB drive in Linux allows you to access files stored on external storage devices such as flash drives, pendrives, or external disks. While modern desktop environments often mount USB devices automatically, many Linux administrators and power users prefer using command-line tools for better control and troubleshooting.
In this guide, you will learn how to identify USB devices, mount them manually using the mount command, verify the mounted filesystem, and safely unmount the device. The quick reference below summarizes the essential steps required to mount a USB drive in Linux.
Quick Steps: Mount USB Drive in Linux
To mount a USB drive in Linux using the command line:
| Step | Command / Action |
|---|---|
| Identify USB device | lsblk |
| Check filesystem type | blkid /dev/sdb1 |
| Create mount directory | sudo mkdir /media/usb |
| Mount USB drive | sudo mount /dev/sdb1 /media/usb |
| Verify mount | mount | grep usb |
| Check mounted device | lsblk |
| Access USB files | cd /media/usb |
| Safely unmount USB | sudo umount /dev/sdb1 |
| Remove temporary mount directory | sudo rm -rf /media/usb |
Step 1: Identify the USB Device in Linux
Before mounting a USB drive, you must first identify the correct device name assigned by the Linux kernel. When a USB storage device is connected, Linux creates a block device under /dev/ such as /dev/sdb or /dev/sdc. The actual partition is usually something like /dev/sdb1.
Identifying the correct device ensures you mount the right storage without affecting other disks on the system.
List USB drives using lsblk
The lsblk command is the easiest way to list all storage devices connected to the system. It displays disks, partitions, and mount points in a tree-like format.
lsblkExample output:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 931.5G 0 disk /
sdb 8:16 1 57.8G 0 disk
└─sdb1 8:17 1 57.8G 0 partHere:
sdbrepresents the USB disksdb1is the partition we will mount
The RM column indicates whether the device is removable.
Identify USB partitions using fdisk -l
The fdisk command provides detailed information about disks and partitions connected to the system.
sudo fdisk -lExample output:
Disk /dev/sdb: 57.76 GiB
Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 121135103 121133056 57.8G 7 HPFS/NTFS/exFATThis command helps confirm:
- disk size
- partition layout
- partition type
This is useful when troubleshooting mount issues.
Check filesystem type using blkid
Before mounting a device, it is helpful to determine the filesystem type. The blkid command displays filesystem metadata including UUID and filesystem type.
sudo blkid /dev/sdb1Example output:
/dev/sdb1: LABEL="USB_DISK" UUID="5E92CAC292CA9E41" TYPE="vfat"Common filesystem types include:
ntfsvfat(FAT32)exfatext4
Knowing the filesystem helps determine which mount options or drivers are required.
Detect newly inserted USB devices using dmesg
The dmesg command displays kernel messages, including logs generated when hardware devices are connected.
Immediately after inserting the USB drive, run:
dmesg | grep -i usbExample output:
usb 2-1: new high-speed USB device number 4 using xhci_hcd
sd 6:0:0:0: [sdb] Attached SCSI removable diskThis confirms the kernel has detected the USB device and shows the assigned device name.
Step 2: Create a Mount Point
Linux requires a directory where the filesystem of the USB drive will be attached. This directory is known as the mount point.
A mount point can be created anywhere, but common locations include:
/media/mnt/run/media
Create a mount directory using:
sudo mkdir /media/usbAfter creating the directory, you can mount the USB device there.
You can also mount the device temporarily using /mnt if you do not want to create a permanent mount directory.
For example:
sudo mount /dev/sdb1 /mntUsing /media/usb is recommended for removable devices because it keeps the filesystem organized.
Step 3: Mount the USB Drive in Linux
Now that you have identified the device and created a directory, you can perform the mount operation. Mounting connects the physical device partition to your directory structure.
In most cases Linux automatically detects the filesystem type when mounting a USB drive. However, if automatic detection fails or the required filesystem driver is missing, you may need to specify the filesystem manually.
sudo mount -t <filesystem> <device> <mount_point>Example for an NTFS device:
sudo mount -t ntfs /dev/sdb1 /media/usbBefore mounting, make sure the required filesystem packages are installed on your system.
Mount NTFS USB drive
NTFS is commonly used on Windows systems. Linux requires the ntfs-3g driver to read and write NTFS partitions.
Mount command:
sudo mount -t ntfs /dev/sdb1 /media/usbRequired packages:
Debian / Ubuntu:
sudo apt install ntfs-3gRHEL / Rocky / AlmaLinux:
sudo dnf install ntfs-3gMount FAT32 USB drive
FAT32 filesystems are supported natively in Linux through the vfat kernel driver, so most systems can mount FAT32 USB drives without installing additional packages.
Mount command:
sudo mount -t vfat /dev/sdb1 /media/usbIf utilities are missing, install:
Debian / Ubuntu:
sudo apt install dosfstoolsRHEL / Rocky / AlmaLinux:
sudo dnf install dosfstoolsMount exFAT USB drive
exFAT is commonly used on modern flash drives and SD cards. Older Linux systems may require additional packages.
Mount command:
sudo mount -t exfat /dev/sdb1 /media/usbRequired packages:
Debian / Ubuntu:
sudo apt install exfat-fuse exfat-utilsRHEL / Rocky / AlmaLinux:
sudo dnf install exfatprogsStep 4: Verify USB Drive Mount
Confirm mounted device using lsblk
The lsblk command shows the mount point associated with the device.
lsblkExample output:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 931.5G 0 disk /
sdb 8:16 1 57.8G 0 disk
└─sdb1 8:17 1 57.8G 0 part /media/usbThis indicates that the USB drive is mounted successfully.
Verify mount using mount command
You can also check mounted filesystems using the mount command.
mount | grep usbExample output:
/dev/sdb1 on /media/usb type vfat (rw,relatime)Access files from the mounted USB directory
Once the device is mounted, you can access the contents by navigating to the mount directory.
cd /media/usbYou can now list or manipulate files stored on the USB drive.
lsStep 5: Unmount USB Drive in Linux
Once you finish working with the USB drive, it is important to unmount it properly before removing the device. Unmounting ensures that all buffered data is written to the disk and prevents filesystem corruption.
Linux provides the umount command to safely detach a mounted filesystem from the directory tree.
Unmount using device name
You can unmount the USB drive by specifying the device partition that was mounted earlier.
sudo umount /dev/sdb1After running the command, the filesystem is detached from the system and the USB device can be safely removed.
Unmount using mount point
Alternatively, you can unmount the device using the mount directory instead of the device name.
sudo umount /media/usbBoth methods achieve the same result and can be used interchangeably depending on which identifier you prefer.
Fix "device busy" error during unmount
Sometimes you may encounter the following error when attempting to unmount the device:
umount: /media/usb: target is busyThis means that some process or terminal session is still accessing the mounted directory. To resolve this issue:
- Exit any terminal currently inside the mount directory
- Close applications accessing files on the USB drive
You can also identify processes using the device with:
lsof +f -- /media/usbAfter stopping the processes, retry the unmount command.
In certain cases, a lazy unmount can be used:
sudo umount -l /media/usbStep 6: Troubleshooting USB Mount Issues
Even when the correct commands are used, USB drives may sometimes fail to mount due to missing drivers, incorrect device identification, or permission issues. The following sections describe common problems and how to resolve them.
USB drive not detected
If the USB drive does not appear after connecting it, verify whether the Linux kernel has detected the device.
First list all block devices:
lsblkIf the USB drive is not visible, check kernel messages generated when the device was inserted:
dmesg | tailYou should see entries indicating that a new USB storage device has been detected. If nothing appears, try inserting the drive into another USB port or reconnecting the device.
Filesystem driver missing
Sometimes the mount operation fails because the system does not have the required filesystem driver installed.
For example, mounting an NTFS device without the proper driver may result in errors. Install the necessary packages and try mounting again.
Debian or Ubuntu systems:
sudo apt install ntfs-3g exfat-fuse exfat-utilsRHEL, Rocky Linux, or AlmaLinux systems:
sudo dnf install ntfs-3g exfatprogsAfter installing the packages, reconnect the USB device and retry the mount operation.
Permission denied while mounting
If you receive a permission error while mounting the device, ensure the command is executed with administrative privileges.
sudo mount /dev/sdb1 /media/usbAlso verify that the mount directory exists and is accessible.
ls -ld /media/usbIf necessary, recreate the mount point and mount the device again.
Device busy during unmount
When attempting to unmount a device, you may see the following error:
umount: target is busyThis indicates that a process is still using the mounted directory.
Check which processes are accessing the mount location:
lsof +f -- /media/usbClose the applications using the device or exit the directory in your terminal. Once no process is using the filesystem, run the unmount command again.
sudo umount /media/usbStep 7: Permanently Mount USB Drive using /etc/fstab
The mounting steps described earlier attach the USB drive only temporarily. After a system reboot, the device will not be mounted automatically.
To make the mount persistent across reboots, you can create an entry in the /etc/fstab file.
Identify device UUID
Using the device name such as /dev/sdb1 is not recommended for permanent mounts because device names may change when additional disks are connected.
Instead, use the UUID (Universally Unique Identifier) of the partition.
sudo blkid /dev/sdb1Example output:
/dev/sdb1: LABEL="USB_DISK" UUID="2c566ef5-fe73-4e1c-aa71-9a8cd77c0b31" TYPE="ntfs"Copy the UUID value for use in the fstab entry.
Add mount entry to /etc/fstab
Open the /etc/fstab configuration file.
sudo nano /etc/fstabAdd a new entry at the end of the file:
UUID=2c566ef5-fe73-4e1c-aa71-9a8cd77c0b31 /media/usb ntfs defaults,nofail,user 0 0The fields represent:
- device identifier (UUID)
- mount point
- filesystem type
- mount options
- dump option
- filesystem check order
The mount options:
- nofail: Prevents the system from hanging at boot if the USB isn't plugged in.
- user: Allows non-root users to mount/unmount the device.
After saving the file, the system will attempt to mount the device automatically during boot.
Test configuration safely
Before rebooting the system, test the configuration to ensure the fstab entry is correct.
sudo mount -aIf no errors are reported, the configuration is valid and the device will mount automatically when the system starts.
Step 7: Format or Change Filesystem of USB Drive in Linux
Formatting prepares a USB storage device with a new filesystem. This operation removes the existing filesystem structure and creates a new one, allowing the device to be used with a different format.
Changing the filesystem type of a USB drive usually requires formatting the device. Before proceeding, ensure that the USB drive does not contain any important data because formatting permanently deletes all files.
Linux provides the mkfs utilities to create filesystems on storage devices.
Format USB drive as FAT32
To format the USB drive with the FAT32 filesystem:
sudo mkfs.vfat /dev/sdb1FAT32 is widely supported across Linux, Windows, and macOS systems, making it a good choice for maximum compatibility.
Format USB drive as NTFS
To format the USB drive using the NTFS filesystem:
sudo mkfs.ntfs /dev/sdb1NTFS supports large files and is commonly used on Windows systems.
Format USB drive as exFAT
To format the USB drive with the exFAT filesystem:
sudo mkfs.exfat /dev/sdb1exFAT is often used on modern flash drives and SD cards because it supports large files without the 4 GB limit present in FAT32.
Format USB drive as EXT4
If the USB drive will be used primarily on Linux systems, you can format it with the EXT4 filesystem.
sudo mkfs.ext4 /dev/sdb1EXT4 provides journaling, better performance, and improved reliability for Linux environments.
Common mkfs tools used for filesystem creation
Linux provides several mkfs utilities for creating filesystems on storage devices.
mkfs.vfat
mkfs.ntfs
mkfs.exfat
mkfs.ext4Each command initializes the device with a different filesystem type, allowing you to choose the format best suited for your usage requirements.
Mount USB Stick, Flash Drive, or Pendrive in Linux
USB storage devices are often referred to by different names such as USB stick, flash drive, thumb drive, or pendrive. In Linux, all of these devices are handled the same way because they are recognized as removable block storage devices.
Understanding removable USB device naming
When a USB drive is connected, the Linux kernel assigns it a device name under the /dev directory. The first internal disk usually appears as /dev/sda, while removable drives may appear as /dev/sdb, /dev/sdc, and so on.
Each partition inside the device is identified with a number:
/dev/sdb1
/dev/sdb2The partition containing the filesystem is the one that must be mounted.
You can confirm the device name using:
lsblkMounting different removable USB storage devices
Regardless of whether the device is called a flash drive, pendrive, or USB stick, the mounting procedure remains the same.
sudo mount /dev/sdb1 /media/usbOnce mounted, the files stored on the device become accessible through the mount directory.
cd /media/usbFrequently Asked Questions
1. How do I mount a USB drive in Linux using command line?
First identify the USB device using lsblk or fdisk -l. Then create a mount point such as /media/usb and mount the device using sudo mount /dev/sdb1 /media/usb.2. How do I find the USB device name in Linux?
You can identify the USB device using commands such as lsblk, blkid, fdisk -l, or dmesg. These commands list connected storage devices and their partitions.3. How do I unmount a USB drive in Linux?
Use the umount command followed by the device name or mount point, for example sudo umount /dev/sdb1 or sudo umount /media/usb.4. How do I permanently mount a USB drive in Linux?
You can permanently mount a USB drive by adding its UUID entry to the /etc/fstab file and specifying the mount point and filesystem type.5. Why is my USB drive not mounting in Linux?
This can happen if the filesystem driver is missing, the device name is incorrect, or the USB drive is already mounted. Installing packages like ntfs-3g or dosfstools and verifying the device using lsblk can help resolve the issue.Summary
Mounting a USB drive in Linux involves identifying the correct device, creating a mount point, attaching the filesystem, and verifying that the device has been mounted successfully.
Key commands used to mount USB drives in Linux
The following commands are commonly used while working with USB storage devices:
lsblk
blkid
mount
umount
mkfsThese tools allow you to identify storage devices, mount filesystems, and manage removable media safely.
Best practices when working with removable storage
When working with USB drives in Linux, follow these best practices to avoid filesystem corruption and data loss:
- Always verify the correct device name before mounting.
- Use a dedicated mount directory such as
/media/usbor/mnt/usb. - Unmount the device before physically removing it.
- Use UUID entries when configuring permanent mounts.
- Ensure required filesystem drivers are installed.
By following these steps and best practices, you can reliably mount, access, and manage USB storage devices across different Linux distributions.


