Mounting a USB drive manually every time you reboot Linux gets old fast. If you’re running a home server, using the drive for backups, or just want it available at startup, here’s how to set up automatic mounting that sticks.
Step 1: Plug in the USB Drive
Start by connecting your USB drive to your Linux machine. Open a terminal and run:
lsblk
This lists all connected block devices. Look for your USB drive—typically something like /dev/sdb1
or /dev/sdc1
.
Step 2: Create a Mount Point
Create a folder where the system will mount the USB drive. You can name it whatever you like, just keep it somewhere logical (e.g., /mnt
or /media
):
sudo mkdir -p /mnt/usbdrive
Step 3: Get the UUID of the Drive
Using the UUID (Universally Unique Identifier) instead of the device name (/dev/sdX
) is more reliable, because Linux device names can change between boots.
To find the UUID:
sudo blkid
Look for your USB drive and copy the UUID, which looks like:
UUID="1234-ABCD"
Step 4: Edit /etc/fstab
The fstab
file controls what filesystems mount automatically at boot. Open it in a text editor with root privileges:
sudo nano /etc/fstab
Add a new line at the end like this:
UUID=1234-ABCD /mnt/usbdrive vfat defaults,nofail 0 0
Breakdown of Options:
UUID=...
: Tells the system which drive to mount./mnt/usbdrive
: Where it should be mounted.vfat
: Filesystem type. Usentfs
orext4
if that’s what your drive uses.defaults,nofail
:defaults
sets standard mount options;nofail
allows boot to continue even if the drive isn’t found.- The
0 0
disables dump and fsck checks—fine for removable drives.
Save and exit (Ctrl+O
, Enter
, then Ctrl+X
if you’re using nano).
Step 5: Test It
Before rebooting, test your fstab entry:
sudo mount -a
If you don’t see any errors, it worked. Now reboot your system and confirm the drive is mounted automatically:
df -h
You should see /mnt/usbdrive
listed.
Wrapping Up
That’s it. Your USB drive will now be mounted automatically every time your Linux system boots up. If you remove the drive and later plug it back in, make sure it’s using the same UUID—or update the fstab
file.
Need to make the drive writable for everyone or adjust permissions? You can tweak the mount options in fstab
as needed.
Want a walkthrough for specific file systems like NTFS or exFAT? Drop a comment and I’ll cover it.
Leave a Reply