lsblk
Open the /etc/fstab
file in a text editor with root privileges:
Step 1: Identify the USB Drive
sudo reboot
Remember to always back up important data before making changes to system files, and if you’re unsure about any step, consult the documentation or seek help from the community.
Step 2: Create a Mount Point
If you use a USB drive regularly on your Linux system, you might want it to automatically mount every time your computer starts up, which can save you time and effort, especially if you rely on the USB drive for daily tasks.
UUID=679C-87F2 /mnt/usbdrive vfat defaults 0 2
If you found this guide helpful, explore the related articles below for more tips and tricks on managing USB drives in Linux!
By following these steps, you can ensure that your USB drive mounts automatically every time your Linux system boots up and saves you the hassle of manually mounting the drive each time you start your computer.
sudo blkid
Save the file and exit the editor (in nano, press CTRL + X
, then Y
, and Enter).
Step 4: Edit the /etc/fstab File
Run the following blkid command to find the UUID of your USB drive:
To ensure that the correct drive is mounted every time, we’ll use the UUID (Universally Unique Identifier) of the USB drive, which is a unique string that identifies the partition.
sudo nano /etc/fstab
df -h
In this guide, we’ll walk you through the steps to make your USB drive mount automatically at boot on a Linux system.
UUID=679C-87F2
: The UUID of the USB drive./mnt/usbdrive
: The mount point.vfat
: The file system type.defaults
: Mount options (default settings).0
: Dump option (used for backups, usually set to 0).2
: File system check order (0 means no check, 1 is for the root file system, 2 is for other file systems).
Finally, reboot your system to ensure that the USB drive mounts automatically at boot:
Step 5: Test the Configuration
Here’s a breakdown of the fields:
sudo dmesg | grep mount
sudo mkdir /mnt/usbdrive
/etc/fstab
file contains information about disk partitions and how they should be mounted. We’ll add an entry for your USB drive so that it mounts automatically at boot.If the USB drive doesn’t mount automatically, check the system logs for errors:
Conclusion
Copy the UUID (the part in quotes after UUID=
), you’ll need it in the next step.
A mount point is a directory where the USB drive will be attached to your file system, so run the following mkdir command to create a mount point:
First, you need to identify the USB drive and its partition by running the following lsblk command, which will list all the storage devices connected to your system: