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:
lsblk
This 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/sdx
Replace 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/sdx1
5. Create a Mount Point
sudo mkdir -p /mnt/usb
6. Mount the Drive
sudo mount /dev/sdx1 /mnt/usb
Run lsblk
to confirm it’s mounted under /mnt/usb
.
7. Auto-Mount on Boot
Get the UUID of your partition:
sudo blkid /dev/sdx1
Copy the UUID and open /etc/fstab
:
sudo vim /etc/fstab
Add this line (replace xxxx
with your UUID):
UUID=xxxx /mnt/usb ext4 defaults 0 2
8. Test the Setup
sudo mount -a
If no errors appear, the USB will mount automatically on boot.