How to Mount and Automount Drives in Linux

Published June 22, 2025
How to Mount and Automount Drives in Linux
Cheap Dedicated Server

Linux offers flexible options for managing storage, including mounting drives manually or automatically at boot. Whether you’re using internal hard drives, SSDs, or external USB storage, understanding how to mount drives is essential for efficient system administration.

📁 What Is Mounting in Linux?

In Linux, mounting is the process of making a filesystem accessible at a certain point in the directory tree. Unlike Windows (which uses drive letters), Linux uses mount points like /mnt or /media.


🔌 How to Mount a Drive Manually

  1. Identify the drive:
    Identify the drive
    sudo fdisk -l
    

    Look for something like /dev/sdb1.

  2. Create a mount point:
    Create a mount point
    sudo mkdir /mnt/mydrive
    
  3. Mount the drive:
    Mount the drive
    sudo mount /dev/sdb1 /mnt/mydrive
    
  4. Access your files:Navigate to /mnt/mydrive to view the contents.
  5. Unmount (when done):
    Unmount (when done)
    sudo umount /mnt/mydrive
    

🔁 How to Automount Drives at Boot (Using /etc/fstab)

  1. Find the UUID of the drive:
    sudo blkid
    
  2. Edit /etc/fstab:Open the file using:
    sudo nano /etc/fstab
    
  3. Add an entry like this:
    UUID=xxxx-xxxx  /mnt/mydrive  ext4  defaults  0  2
    

    Replace UUID=xxxx-xxxx with your actual UUID, and ext4 with your file system type (e.g., ntfs, vfat).

  4. Test the configuration:
    Test the configuration
    sudo mount -a
    

📦 Automounting External Drives with udevil or udisksctl

For desktop systems:

  • GNOME and KDE automatically handle USB devices via udisks2.
  • CLI tools like udisksctl or udevil can also be used.

Example:
Automounting External Drives

udisksctl mount -b /dev/sdb1

✅ Best Practices

  • Always unmount external drives before removing them.
  • Use UUIDs in /etc/fstab instead of device names (/dev/sdb1) to avoid conflicts.
  • For NTFS or FAT32, install ntfs-3g or dosfstools packages.

 

How to Mount and Automount Drives in Linux (F.A.Q)

How do I know what filesystem my drive uses?

 

Run sudo blkid or lsblk -f to see the filesystem type (e.g., ext4, ntfs, vfat).

 

What happens if I mess up /etc/fstab?

 Your system may fail to boot. Boot into recovery mode or use a live USB to fix the file.

 

Can I mount drives read-only?

Yes, use ro instead of defaults in the mount options:

 
UUID=xxxx-xxxx /mnt/drive ext4 ro 0 2

 

How to automatically mount USBs on plug-in?

Use udisks2, which is typically pre-installed on most Linux desktop environments. It handles automounting.