Mounting storage devices in Linux is a fundamental skill for managing file systems, and understanding how to mount in Linux is essential for accessing external drives, partitions, and network shares. This guide walks you through the process step by step, from basic commands to advanced options.
When you plug in a USB drive or add a new hard disk, Linux doesn’t automatically make it accessible like Windows does. You need to attach it to a specific directory—this is called mounting. Once mounted, you can read and write files just like any other folder.
Think of mounting as connecting a device to your system’s directory tree. The device could be a physical drive, an ISO file, or even a remote server. The mount point is the directory where you access the device’s contents.
Understanding Mount Points And Devices
Before you start, you need to know what devices are available and where they are located. Linux treats everything as a file, including hardware devices. Storage devices appear under /dev with names like /dev/sda, /dev/sdb1, or /dev/nvme0n1.
Common device naming conventions:
/dev/sda– First SCSI/SATA disk/dev/sdb– Second disk/dev/sda1– First partition on first disk/dev/nvme0n1– NVMe SSD/dev/mmcblk0– SD card or eMMC
To list all block devices, use lsblk or fdisk -l. These commands show partitions, sizes, and mount points. For example:
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 238.5G 0 disk
├─sda1 8:1 0 512M 0 part /boot/efi
├─sda2 8:2 0 237.1G 0 part /
sdb 8:16 1 14.9G 0 disk
└─sdb1 8:17 1 14.9G 0 part /media/usb
The output shows your system’s disks, partitions, and where they are currently mounted. If a device has no mount point, it’s not yet accessible.
How To Mount In Linux
Now let’s get to the core of this guide: the actual mounting process. The mount command is your primary tool. Its basic syntax is:
mount [options] device mount_point
You need root privileges (sudo) for most mount operations. Here’s a typical example:
sudo mount /dev/sdb1 /mnt/usb
This mounts the first partition of the second disk (/dev/sdb1) to the directory /mnt/usb. If the mount point doesn’t exist, create it first with mkdir.
Step-By-Step Mounting A USB Drive
- Plug in your USB drive.
- Identify the device with
lsblkordmesg | tail. - Create a mount point:
sudo mkdir /mnt/myusb - Mount the drive:
sudo mount /dev/sdb1 /mnt/myusb - Verify with
df -hormount | grep myusb
After mounting, you can access files under /mnt/myusb. To unmount, use sudo umount /mnt/myusb (note: it’s umount, not unmount).
Mounting With Filesystem Type
Sometimes the system doesn’t auto-detect the filesystem. You can specify it with the -t option. Common types include ext4, ntfs, vfat, and exfat.
sudo mount -t ntfs-3g /dev/sdb1 /mnt/windows
For FAT32 drives, use vfat. For exFAT, you might need to install exfat-utils first.
Mounting With Options
The -o option lets you pass mount options. Common ones include:
ro– Mount read-onlyrw– Mount read-write (default)noexec– Prevent execution of binariesnosuid– Ignore suid bitsuid=1000,gid=1000– Set owner for FAT/NTFS drives
sudo mount -o ro,noexec /dev/sdb1 /mnt/secure
This mounts the drive read-only and prevents any program from running on it.
Mounting ISO Files
You can mount disk images (ISO files) without burning them. This is useful for software installations or accessing archives.
sudo mount -o loop /path/to/file.iso /mnt/iso
The -o loop option tells the system to use a loop device. After mounting, you can browse the ISO contents. Unmount with sudo umount /mnt/iso.
Mounting Network Shares (NFS And Samba)
Linux can mount remote directories using NFS (Network File System) or SMB/CIFS (Samba/Windows shares).
Mounting NFS Shares
First, install the NFS client: sudo apt install nfs-common (Debian/Ubuntu) or sudo dnf install nfs-utils (Fedora).
sudo mount -t nfs 192.168.1.100:/shared /mnt/nfs
Replace the IP and path with your server’s details. You can add options like vers=4 for NFS version 4.
Mounting Samba Shares
Install the CIFS utilities: sudo apt install cifs-utils.
sudo mount -t cifs //192.168.1.100/share /mnt/samba -o username=user,password=pass
For better security, use a credentials file instead of plain text passwords.
Auto-Mounting With Fstab
If you want a device to mount automatically at boot, add an entry to /etc/fstab. This file defines filesystem mount points.
A typical fstab line looks like:
UUID=1234-5678 /mnt/data ext4 defaults 0 2
Find the UUID with blkid. Using UUIDs is better than device names because they don’t change.
Adding A USB Drive To Fstab
- Get the UUID:
sudo blkid /dev/sdb1 - Edit fstab:
sudo nano /etc/fstab - Add a line:
UUID=ABCD-1234 /mnt/usb vfat defaults,uid=1000,gid=1000 0 0 - Test with
sudo mount -a(mounts all fstab entries)
Be careful with fstab—a mistake can prevent your system from booting. Always test with mount -a before rebooting.
Common Mount Options Explained
Here are frequently used options for the -o flag:
defaults– Uses rw, suid, dev, exec, auto, nouser, and asyncauto– Mount at boot (or withmount -a)noauto– Only mount manuallyuser– Allow regular users to mountnouser– Only root can mountsync– Write data immediately (slower but safer)async– Write data later (faster but riskier)atime– Update access times (default)noatime– Don’t update access times (faster)
Unmounting Devices Safely
Always unmount before physically removing a device. Use umount followed by the mount point or device:
sudo umount /mnt/usb
If the device is busy (files are open), use lsof /mnt/usb to find processes using it. You can force unmount with sudo umount -l /mnt/usb (lazy unmount), but this is risky.
Troubleshooting Common Mount Issues
Here are typical problems and solutions:
Device Is Busy
If you get “target is busy,” close file managers or terminal sessions in that directory. Use fuser -m /mnt/usb to find processes.
Wrong Filesystem Type
If you see “wrong fs type,” specify the filesystem with -t or install the required driver (e.g., ntfs-3g for NTFS).
Permission Denied
For FAT/NTFS drives, use uid=1000,gid=1000 to set ownership. For ext4, check permissions with chmod and chown.
Mount Point Not Empty
If the mount point directory has files, they become hidden while the device is mounted. Use an empty directory to avoid confusion.
Using Systemd Mount Units
Modern Linux systems can use systemd mount units instead of fstab. Create a file like /etc/systemd/system/mnt-data.mount:
[Unit]
Description=Mount data partition
[Mount]
What=/dev/sdb1
Where=/mnt/data
Type=ext4
Options=defaults
[Install]
WantedBy=multi-user.target
Then enable it with sudo systemctl enable mnt-data.mount and start with sudo systemctl start mnt-data.mount.
Mounting Removable Media Automatically
Desktop environments like GNOME or KDE handle automounting via udisks. For headless servers, you can use autofs for on-demand mounting.
Install autofs: sudo apt install autofs. Configure it in /etc/auto.master and /etc/auto.misc.
Security Considerations
When mounting external drives, be aware of security risks:
- Use
noexecon untrusted drives to prevent malware execution - Avoid mounting with
suidunless necessary - For network shares, use encrypted protocols (NFSv4 with Kerberos, SMB with encryption)
- Check fstab entries for typos that could expose data
Advanced Mount Techniques
For power users, here are some advanced scenarios:
Bind Mounts
Mount a directory to another location without copying files:
sudo mount --bind /home/user/docs /mnt/backup
Overlay Mounts
Combine multiple directories into one view (useful for live CDs):
sudo mount -t overlay overlay -o lowerdir=/lower,upperdir=/upper,workdir=/work /merged
Remounting
Change mount options without unmounting:
sudo mount -o remount,ro /mnt/data
Frequently Asked Questions
What Is The Difference Between Mount And Mount Point?
The mount command attaches a device to the system. A mount point is the directory where the device’s filesystem becomes accessible.
How Do I See All Mounted Filesystems?
Use mount without arguments, or df -h for a human-readable list. The findmnt command provides a tree view.
Can I Mount A Device Without Root?
Yes, if the device is listed in /etc/fstab with the user option, or if you use udisksctl mount -b /dev/sdb1 (works in most desktop environments).
Why Do I Get “Mount: /Dev/sdb1 Is Already Mounted”?
The device is already attached to a mount point. Use mount | grep sdb1 to find where, or unmount it first if you want to change the location.
How Do I Mount A Drive Permanently?
Add an entry to /etc/fstab with the device’s UUID, mount point, filesystem type, and options. Then run sudo mount -a to test.
Mastering how to mount in Linux opens up full control over your storage. Whether you’re connecting a USB drive, accessing a network share, or working with disk images, the mount command is your gateway. Practice with different options and always unmount safely to protect your data.