Mounting and Using a USB Drive on Linux – Step by Step
If you’re a Linux user, chances are you’ve plugged in a USB drive and wondered, “Now what?”. Whether it’s a flash drive, SSD, HDD, or MMC card, the process is almost the same. Below is a clean walkthrough for detecting, formatting, mounting, and even auto-mounting your drive.
Follow these steps to get it working like a pro:
1. Check if Your System Detects the Device
Plug in the USB and check if it’s recognized:
lsblkThis lists all drives and partitions. Look for something like sdx (where x is a letter).
2. Wipe and Format the Drive
Warning: This erases everything on it.
sudo mkfs.ext4 /dev/sdxReplace x with your drive letter.
3. Create a Partition Table
sudo fdisk /dev/sdx- Press g → GPT partition table
- Press n → New partition
- Press Enter for all defaults
- Press w → Save and exit
4. Format the New Partition
After fdisk, you should see something like /dev/sdx1:
sudo mkfs.ext4 /dev/sdx15. Create a Mount Point
sudo mkdir -p /mnt/usb6. Mount the Drive
sudo mount /dev/sdx1 /mnt/usbRun lsblk to confirm it’s mounted under /mnt/usb.
7. Auto-Mount on Boot
Get the UUID of your partition:
sudo blkid /dev/sdx1Copy the UUID and open /etc/fstab:
sudo vim /etc/fstabAdd this line (replace xxxx with your UUID):
UUID=xxxx /mnt/usb ext4 defaults 0 28. Test the Setup
sudo mount -aIf no errors appear, the USB will mount automatically on boot.