The mount command in Linux connects storage devices to the system’s directory tree. Understanding what is mount in Linux is essential for anyone working with filesystems, external drives, or network shares. Without mounting, your system cannot access data on a storage device.
Think of mounting like plugging a USB drive into a computer. The operating system must assign a location—a mount point—so you can see and use the files. In Linux, this process is manual and gives you full control.
This article explains mounting clearly. You will learn the basics, commands, and practical examples. By the end, you will confidently manage mounts on your Linux system.
What Is Mount In Linux
Mounting is the process of attaching a filesystem to a specific directory in the Linux directory tree. This directory becomes the access point for the device’s data. For example, when you insert a CD-ROM, Linux mounts it to /media/cdrom or a similar path.
The mount command tells the kernel to make a filesystem available at a given location. Without mounting, the device is just a block of raw data. The kernel cannot interpret it until you specify where it belongs.
Every Linux system has a root filesystem mounted at /. Other devices, like hard drives or USB sticks, must be mounted to subdirectories. This structure keeps everything organized and accessible.
Mounting is not permanent by default. You can unmount a device when you are done, freeing the directory for other uses. This flexibility is a core feature of Linux filesystem management.
Why Mounting Matters
Mounting gives you control over storage. You decide where a device appears and how it is accessed. This is different from Windows, which often assigns drive letters automatically.
Linux supports many filesystem types: ext4, NTFS, FAT32, and more. Mounting handles these differences. You can mount a Windows partition or a network share with the right options.
Mounting also improves security. You can mount a filesystem as read-only to prevent accidental changes. This is useful for system recovery or sharing data safely.
How The Mount Command Works
The basic syntax of the mount command is simple:
mount [options] device directory
You specify the device (like /dev/sdb1) and the directory (mount point) where it will appear. The mount point must exist before you run the command.
For example, to mount a USB drive:
sudo mount /dev/sdb1 /mnt/usb
This attaches the first partition of the second SCSI disk to the /mnt/usb directory. Now you can access files in /mnt/usb.
If you omit the device, mount shows all currently mounted filesystems. This is handy for checking what is attached.
Common Mount Options
Options modify how mounting works. Here are key ones:
-t: Specify filesystem type (e.g.,-t ext4)-o: Pass options likero(read-only) orrw(read-write)-a: Mount all filesystems listed in/etc/fstab-r: Mount as read-only-v: Verbose output for debugging
Example with options:
sudo mount -t ntfs-3g -o ro /dev/sdc1 /mnt/windows
This mounts an NTFS partition as read-only. The ntfs-3g driver is required for NTFS support.
Finding Devices To Mount
Before mounting, you need to know the device name. Use these commands:
lsblk: Lists block devices with sizes and mount pointsfdisk -l: Shows partition tables (requires sudo)blkid: Displays UUIDs and filesystem types
Example output from 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 /mnt/usb
Here, /dev/sdb1 is already mounted at /mnt/usb. The lsblk command is quick and does not require root.
Creating Mount Points
A mount point is just an empty directory. You can create it anywhere with mkdir. Common locations include /mnt for temporary mounts and /media for removable media.
Steps to create a mount point:
- Choose a location, e.g.,
/mnt/data - Create the directory:
sudo mkdir /mnt/data - Mount the device:
sudo mount /dev/sdb1 /mnt/data
Always use an empty directory. Mounting over a non-empty directory hides its contents until you unmount. This can cause confusion.
Unmounting Devices
To detach a filesystem, use the umount command (note: no ‘n’ after ‘u’):
sudo umount /mnt/usb
You can specify the device or mount point. The command fails if the filesystem is busy—files are open or a process is using it. Use lsof or fuser to find the culprit.
Force unmount with -f if necessary, but this risks data loss. Always unmount properly before removing a USB drive.
Permanent Mounts With /Etc/fstab
The /etc/fstab file defines filesystems that mount automatically at boot. Each line describes a device, mount point, filesystem type, options, dump, and pass.
Example /etc/fstab entry:
UUID=abc123 /mnt/data ext4 defaults 0 2
Using UUIDs is safer than device names because device names can change. Get the UUID with blkid.
Steps to add a permanent mount:
- Find the UUID:
sudo blkid /dev/sdb1 - Edit
/etc/fstab:sudo nano /etc/fstab - Add a line with UUID, mount point, filesystem, and options
- Test with:
sudo mount -a
If mount -a runs without errors, the entry is valid. Incorrect entries can prevent booting, so backup the file first.
Common Fstab Options
Options in fstab control behavior:
defaults: Use standard settings (rw, suid, dev, exec, auto, nouser, async)noauto: Do not mount automatically at bootuser: Allow any user to mountnofail: Ignore errors if device is missingerrors=remount-ro: Remount as read-only on error
Example for a network share:
//server/share /mnt/nfs nfs defaults,_netdev 0 0
The _netdev option tells the system to wait for networking.
Mounting Network Filesystems
Linux can mount remote filesystems over a network. Common types are NFS (Network File System) and CIFS (Common Internet File System, used by Windows shares).
Mounting NFS Shares
First, install the NFS client:
sudo apt install nfs-common # Debian/Ubuntu
sudo yum install nfs-utils # RHEL/CentOS
Then mount:
sudo mount -t nfs 192.168.1.100:/shared /mnt/nfs
Replace the IP and path with your server details. The mount point must exist.
Mounting CIFS Shares
For Windows shares, use CIFS:
sudo mount -t cifs //192.168.1.50/share /mnt/cifs -o username=user,password=pass
Storing passwords in commands is insecure. Use a credentials file instead:
sudo mount -t cifs //server/share /mnt/cifs -o credentials=/etc/smbcreds
The credentials file contains:
username=user
password=pass
domain=workgroup
Set permissions: sudo chmod 600 /etc/smbcreds.
Mounting ISO Files
ISO files are disk images. Mount them like a physical disc using the loop device:
sudo mount -o loop /path/to/image.iso /mnt/iso
The -o loop option creates a virtual loop device. This is useful for installing software or accessing archived data.
To unmount:
sudo umount /mnt/iso
No need to remove the loop device manually; Linux cleans it up.
Mounting With Systemd
Modern Linux distributions use systemd for mount management. You can create mount units for complex setups.
Example mount unit file /etc/systemd/system/mnt-data.mount:
[Unit]
Description=Mount data partition
[Mount]
What=/dev/disk/by-uuid/abc123
Where=/mnt/data
Type=ext4
Options=defaults
[Install]
WantedBy=multi-user.target
Enable with:
sudo systemctl enable mnt-data.mount
sudo systemctl start mnt-data.mount
Systemd mounts are more reliable for complex dependencies, like network shares.
Common Mounting Errors
Even experienced users encounter errors. Here are frequent ones:
- mount: special device does not exist : The device name is wrong or the device is not connected.
- mount: wrong fs type : Missing filesystem driver. Install
ntfs-3gfor NTFS orexfat-fusefor exFAT. - mount: /mnt/point is busy : A process is using the filesystem. Use
lsof /mnt/pointto find it. - mount: permission denied : You need root privileges for most mounts. Use
sudo.
Always check dmesg for kernel messages. They often reveal hardware or driver issues.
Best Practices For Mounting
Follow these guidelines to avoid problems:
- Always unmount before removing a device
- Use UUIDs in
/etc/fstabinstead of device names - Mount removable media under
/media - Test fstab entries with
mount -abefore rebooting - Keep mount points empty to avoid hidden files
These habits prevent data loss and system instability.
Advanced Mounting Techniques
For power users, mounting offers more flexibility:
Bind Mounts
A bind mount makes a directory appear in another location:
sudo mount --bind /home/user/data /mnt/backup
Changes in one location reflect in the other. Useful for backups or chroot environments.
Overlay Filesystems
Overlay mounts combine two directories into one view. Used by Docker and live CDs:
sudo mount -t overlay overlay -o lowerdir=/lower,upperdir=/upper,workdir=/work /merged
This creates a merged view where changes go to the upper directory.
Remounting
Change mount options without unmounting:
sudo mount -o remount,ro /mnt/data
This remounts as read-only. Useful for emergency repairs.
Frequently Asked Questions
What Does Mount Mean In Linux?
Mounting attaches a filesystem to a directory, making its contents accessible. It is how Linux integrates storage devices into the file hierarchy.
How Do I See All Mounted Filesystems?
Run mount without arguments, or use df -h for human-readable output. lsblk also shows mount points.
What Is The Difference Between Mount And Fstab?
Mount is a command for temporary attachment. Fstab is a configuration file for permanent mounts that load at boot.
Can I Mount A Device Without Root?
Yes, if the device is listed in /etc/fstab with the user option. Otherwise, root privileges are required.
Why Does Unmount Fail With “Device Is Busy”?
A process is using a file on the filesystem. Use lsof or fuser -m to identify and close the process.
Conclusion
Now you understand what is mount in Linux. You have learned the command syntax, options, and practical examples. Mounting is a fundamental skill for managing storage on Linux systems.
Practice with different devices and filesystem types. Experiment with fstab for automatic mounts. Over time, mounting becomes second nature.
Remember to unmount safely and check for errors. With these skills, you can handle any storage scenario on Linux.