How to Mount USB Drive in Linux
Mounting a USB drive in Linux is straightforward once you understand how the system names devices and where it attaches them. This guide walks through identifying, mounting, and safely removing a USB drive from the command line, plus the automatic options most desktops provide.
Step 1: Identify the USB Device
When you plug in a USB drive, the kernel assigns it a device name like /dev/sdb, with partitions numbered /dev/sdb1, /dev/sdb2, and so on. To see them:
Read also: Linux Network Commands Every Admin Should Know
lsblk— lists all block devices in a tree, showing size and current mount points. This is the clearest view.sudo fdisk -l— shows detailed partition tables for every disk.sudo dmesg | tail— run this right after plugging in the drive to see which device name the kernel just assigned.
Look for a device whose size matches your USB stick. A 32 GB drive showing up as /dev/sdb1 is your target.
Step 2: Create a Mount Point and Mount
A mount point is just an empty directory where the drive’s contents will appear. Create one and then attach the partition:
sudo mkdir -p /mnt/usb— create the directory.sudo mount /dev/sdb1 /mnt/usb— mount the partition there.
Now browse the files with ls /mnt/usb. For most modern drives the filesystem is auto-detected, but you can be explicit with the -t flag, for example sudo mount -t vfat /dev/sdb1 /mnt/usb.
Handling Different Filesystems
- FAT32 / exFAT — common on USB sticks. exFAT may need the
exfatprogsorexfat-fusepackage. - NTFS — Windows drives. Install
ntfs-3gfor full read/write support. - ext4 — native Linux. Mounts without extra packages.
Step 3: Mounting With Correct Permissions
By default a FAT or NTFS drive may be owned by root, preventing your user from writing. Mount with your user and group IDs to fix this:
sudo mount -o uid=$(id -u),gid=$(id -g) /dev/sdb1 /mnt/usb
Find your IDs at any time with id -u and id -g. For ext4 drives, ownership is stored in the filesystem itself, so use chown after mounting instead.
Step 4: Safely Unmount the Drive
Never pull out a USB drive without unmounting first, or you risk corrupting data still sitting in the write cache. To detach it cleanly:
sudo umount /mnt/usb— unmount by mount point, or use the device namesudo umount /dev/sdb1.- If you get a “target is busy” error, run
lsof /mnt/usbto find what’s using it, or simplycdout of the directory first. sync— forces any buffered writes to flush to disk before removal.
Automatic Mounting on the Desktop
On GNOME, KDE, and most desktop environments, the udisks2 service mounts USB drives automatically under /run/media/yourname/ the moment you insert them. From a terminal you can replicate this without root using udisksctl mount -b /dev/sdb1 and unmount with udisksctl unmount -b /dev/sdb1. If you want a fixed drive to mount at every boot, add an entry to /etc/fstab using the drive’s UUID (find it with sudo blkid) for reliability.
Frequently Asked Questions
How do I know which device name my USB drive got?
Run lsblk before and after plugging it in, or check sudo dmesg | tail immediately after insertion. The new entry, usually /dev/sdb1 or similar, is your drive.
Why can’t I write to my USB drive after mounting?
FAT and NTFS drives often mount as root-owned. Remount with -o uid=$(id -u),gid=$(id -g), or for NTFS make sure the ntfs-3g package is installed for write support.
What does “target is busy” mean when unmounting?
A process still has the drive open, or your shell is inside the mounted directory. Run cd ~ to leave it and use lsof /mnt/usb to identify any lingering programs, then unmount again.
Do I always need sudo to mount a USB drive?
The mount command needs root, but udisksctl mount and desktop auto-mounting let you mount removable media as a normal user without sudo.






