How To Mount A Drive In Linux – Auto Mount Fstab Configuration

Adding a drive to Linux means creating a mount point and using the mount command with the correct device identifier. If you have ever wondered how to mount a drive in linux, this guide will walk you through every step, from identifying your drive to making the mount permanent. Whether you are adding an internal SSD, an external USB, or a network drive, the process is straightforward once you understand the basics.

Linux treats everything as a file, including drives. When you plug in a new drive, it is not automatically accessible like in Windows or macOS. You need to attach it to a specific directory, called a mount point, using the mount command. This gives you full control over where and how the drive appears in your file system.

Do not worry if you are new to the command line. This article uses simple commands and explains each one. By the end, you will be able to mount any drive with confidence.

Understanding Linux Drive Mounting

Before you start, it helps to know what mounting actually means. In Linux, the file system is a single tree starting at the root directory (/). When you mount a drive, you attach its file system to a specific folder in that tree. That folder becomes the access point for all files on the drive.

For example, if you mount a USB drive to /mnt/usb, you can browse its contents by navigating to that directory. The drive itself is not the mount point; the mount point is just an empty directory you create.

Why Mounting Is Necessary

Linux does not automatically assign drive letters like Windows. Instead, you decide where each drive appears. This gives you flexibility but requires a manual step. Mounting also lets you control permissions, file system types, and whether the drive is read-only or writable.

Common Use Cases

  • Adding a new internal hard drive or SSD
  • Connecting an external USB drive or flash drive
  • Mounting network shares (NFS or Samba)
  • Accessing ISO files or virtual drives

How To Mount A Drive In Linux

Now let us get into the actual process. The steps below assume you have a drive physically connected to your system. We will cover identifying the drive, creating a mount point, and mounting it.

Step 1: Identify The Drive

First, you need to know the device name of your drive. Linux uses names like /dev/sda, /dev/sdb, and so on. The first drive is usually sda, the second is sdb, and so forth. Partitions on a drive are numbered, like /dev/sda1 or /dev/sdb2.

Use the lsblk command to list all block devices. This shows you the drive names, sizes, and mount points if any.

lsblk

Look for a drive that is not mounted. It will have no mount point listed under the MOUNTPOINT column. For example, /dev/sdb might appear with a partition /dev/sdb1 but no mount point. That is your target.

You can also use sudo fdisk -l for more detailed information, including file system types.

Step 2: Create A Mount Point

A mount point is just an empty directory. You can create it anywhere, but common locations include /mnt or /media. Use the mkdir command to make a new directory.

sudo mkdir /mnt/mydrive

Replace mydrive with a descriptive name. This directory will become the access point for your drive.

Step 3: Mount The Drive

Now use the mount command to attach the drive. The basic syntax is:

sudo mount /dev/sdb1 /mnt/mydrive

Replace /dev/sdb1 with your actual partition and /mnt/mydrive with your mount point. If the drive uses a common file system like ext4, NTFS, or FAT32, the mount command will detect it automatically.

After running the command, check if it worked by listing the contents of the mount point:

ls /mnt/mydrive

You should see the files on the drive.

Step 4: Verify The Mount

Use the mount command without arguments to see all mounted file systems. You can also use df -h to see disk usage with mount points.

mount | grep /mnt/mydrive

If the drive appears, you have successfully mounted it.

Mounting Different File System Types

While the basic mount command works for most drives, some file systems require extra options. Here are common scenarios.

Mounting NTFS Drives

Windows NTFS drives often need the ntfs-3g driver. Install it if missing:

sudo apt install ntfs-3g   # Debian/Ubuntu
sudo yum install ntfs-3g   # RHEL/CentOS

Then mount with:

sudo mount -t ntfs-3g /dev/sdb1 /mnt/mydrive

Mounting FAT32 Or ExFAT Drives

FAT32 is usually supported out of the box. For exFAT, you may need the exfat-utils package.

sudo mount -t vfat /dev/sdb1 /mnt/mydrive   # FAT32
sudo mount -t exfat /dev/sdb1 /mnt/mydrive  # exFAT

Mounting Network Drives (NFS)

For NFS shares, first install the NFS client:

sudo apt install nfs-common

Then mount:

sudo mount -t nfs 192.168.1.100:/shared /mnt/nfs

Making The Mount Permanent

By default, mounts are temporary and disappear after a reboot. To make a drive mount automatically at boot, you edit the /etc/fstab file. This file tells Linux which drives to mount and where.

Finding The UUID

Instead of using device names like /dev/sdb1, which can change, it is safer to use the UUID (Universally Unique Identifier). Find the UUID with:

sudo blkid

Look for your partition and copy the UUID value. It looks like UUID="abc123-...".

Editing /Etc/fstab

Open the file with a text editor:

sudo nano /etc/fstab

Add a line at the end in this format:

UUID=your-uuid /mnt/mydrive ext4 defaults 0 2

Replace your-uuid with the actual UUID, /mnt/mydrive with your mount point, and ext4 with your file system type (e.g., ntfs-3g, vfat). The defaults option works for most cases. The numbers at the end control dump and fsck order; use 0 2 for non-root drives.

Save the file and test the entry with:

sudo mount -a

If no errors appear, the drive will mount automatically on next boot.

Unmounting A Drive

To safely remove a drive, unmount it first. Use the umount command (note the spelling: no ‘n’ before ‘mount’):

sudo umount /mnt/mydrive

You can also use the device name:

sudo umount /dev/sdb1

Always unmount before physically disconnecting a drive to prevent data corruption.

Troubleshooting Common Issues

Sometimes mounting fails. Here are frequent problems and fixes.

Device Busy Error

If you get “device is busy,” a process is using the drive. Find it with:

lsof /mnt/mydrive

Close the process or use fuser -km /mnt/mydrive to kill it.

Wrong File System Type

If the mount command fails, specify the file system type explicitly with -t. For example:

sudo mount -t ext4 /dev/sdb1 /mnt/mydrive

Permission Denied

If you cannot access files after mounting, check permissions. You may need to change ownership or mount with specific options:

sudo mount -o uid=1000,gid=1000 /dev/sdb1 /mnt/mydrive

Replace 1000 with your user ID (find it with id -u).

Using Graphical Tools

If you prefer a GUI, most desktop environments have disk utilities. For example, GNOME Disks (gnome-disk-utility) lets you mount drives with a click and edit fstab entries. However, the command line gives you more control and is essential for servers.

Security Considerations

Mounting drives, especially network shares, can expose your system. Always use secure options like noexec to prevent executing binaries from the drive, and nosuid to ignore setuid bits. Add these to your mount options in fstab:

UUID=your-uuid /mnt/mydrive ext4 defaults,noexec,nosuid 0 2

Frequently Asked Questions

What Is The Difference Between Mount And Fstab?

The mount command attaches a drive temporarily. The /etc/fstab file defines permanent mounts that happen at boot. You use both together for a complete setup.

Can I Mount A Drive Without Sudo?

By default, only root can mount drives. However, you can configure sudoers or use udisks for user-level mounting. Some desktop environments allow it automatically.

How Do I Mount A Drive In Linux Permanently?

Add an entry to /etc/fstab with the UUID, mount point, file system type, and options. Then run sudo mount -a to test it.

Why Does My Drive Mount As Read-only?

This often happens with NTFS drives that were not properly unmounted in Windows. You can force mount with sudo mount -o remount,rw /dev/sdb1 or fix the file system in Windows.

How Do I Find The UUID Of A Drive?

Use sudo blkid or ls -l /dev/disk/by-uuid/. The UUID is a long string that uniquely identifies the partition.

Conclusion

Now you know how to mount a drive in linux from start to finish. The process involves identifying the drive, creating a mount point, using the mount command, and optionally making it permanent via fstab. Whether you are working with internal drives, USB sticks, or network shares, these steps will work every time.

Practice on a spare drive to build confidence. Once you understand the basics, you can automate mounts with scripts or manage complex setups. Linux gives you full control, and mounting is a fundamental skill for any user.

If you run into issues, check the dmesg logs with dmesg | tail for kernel messages about the drive. Most problems are easy to fix with a little troubleshooting. Happy mounting.