How to Mount and Unmount File Systems in Linux

By 

Updated on

8 min read

How to Mount and Unmount File Systems in Linux

In Linux and Unix-like systems, the mount command attaches file systems and removable devices such as USB drives to a mount point in the directory tree. The umount command detaches them when you are done.

This guide explains how to mount and unmount file systems in Linux using the mount and umount commands, including USB drives, ISO files, NFS shares, and persistent /etc/fstab entries.

How to List Mounted File Systems

When used without any argument, the mount command will display all currently attached file systems:

Terminal
mount

By default, the output will include all file systems including the virtual ones such as cgroup, sysfs, and others. Each line contains information about the device name, the directory to which the device is mounted, the type of the filesystem, and the mount options in the following form:

txt
device_name on directory type filesystem_type (options)

To display only certain file systems, use the -t option.

For example, to print only the ext4 partitions you would use:

Terminal
mount -t ext4

Mounting a File System

To mount a file system in a given location (mount point), use the mount command in the following form:

txt
mount [OPTION...] DEVICE_NAME DIRECTORY

Once the file system is attached, the mount point becomes the root directory of the mounted file system.

For example, to mount the /dev/sdb1 file system to the /mnt/media directory you would use:

Terminal
sudo mount /dev/sdb1 /mnt/media

Usually when mounting a device with a common file system such as ext4 or xfs, the mount command will auto-detect the file system type. However, some file systems are not recognized and need to be explicitly specified.

Use the -t option to specify the file system type:

txt
mount -t TYPE DEVICE_NAME DIRECTORY

To specify additional mount options , use the -o option:

txt
mount -o OPTIONS DEVICE_NAME DIRECTORY

Multiple options can be provided as a comma-separated list (do not insert a space after a comma).

You can get a list of all mount options by typing man mount in your terminal.

Mounting a File System using /etc/fstab

When providing just one parameter (either directory or device) to the mount command, it will read the content of the /etc/fstab configuration file to check whether the specified file system is listed or not.

If the /etc/fstab contains information about the given file system, the mount command uses the value for the other parameter and the mount options specified in the fstab file.

The /etc/fstab file contains a list of entries in the following form:

/etc/fstabtxt
[File System] [Mount Point] [File System Type] [Options] [Dump] [Pass]

Use the mount command in one of the following forms to attach a file system specified in the /etc/fstab file:

txt
mount [OPTION...] DIRECTORY
mount [OPTION...] DEVICE_NAME

Mounting USB Drive

On most modern Linux distributions, USB drives will auto-mount when you plug them in, but sometimes you may need to manually mount the drive.

To manually mount a USB device, perform the following steps:

  1. Create the mount point:

    Terminal
    sudo mkdir -p /media/usb
  2. To find the device name and filesystem type, use one of the following commands:

    Terminal
    lsblk
    fdisk -l
    dmesg
  3. Assuming that the USB drive uses the /dev/sdd1 device, mount it to the /media/usb directory:

    Terminal
    sudo mount /dev/sdd1 /media/usb

To mount exFAT formatted USB drives, install the free FUSE exFAT module and tools .

Mounting ISO Files

You can mount an ISO file using the loop device, which is a special pseudo-device that makes a file accessible as a block device.

  1. Start by creating the mount point, it can be any location you want:

    Terminal
    sudo mkdir /media/iso
  2. Mount the ISO file to the mount point by typing the following command:

    Terminal
    sudo mount /path/to/image.iso /media/iso -o loop

    Replace /path/to/image.iso with the path to your ISO file.

Mounting NFS

To mount an NFS share , you will need to have the NFS client package installed on your system.

  • Install NFS client on Ubuntu, Debian, and Derivatives:

    Terminal
    sudo apt install nfs-common
  • Install NFS client on Fedora, RHEL, and Derivatives:

    Terminal
    sudo dnf install nfs-utils

Use the steps below to mount a remote NFS directory on your system:

  1. Create a directory to serve as the mount point for the remote filesystem:

    Terminal
    sudo mkdir /media/nfs
  2. Generally, you will want to mount the remote NFS share automatically at boot. To do so, open the /etc/fstab file with your text editor :

    Terminal
    sudo nano /etc/fstab

    Add the following line to the file, replacing remote.server:/dir with the NFS server IP address or hostname and the exported directory:

    /etc/fstabini
    # <file system>    <dir>       <type>   <options>   <dump>	<pass>
    remote.server:/dir /media/nfs  nfs      defaults    0       0
  3. Mount the NFS share by running the following command:

    Terminal
    sudo mount /media/nfs

Creating a Mount Point

Before you mount a file system manually, the target directory must already exist. This directory is called the mount point.

To create a mount point, use mkdir:

Terminal
sudo mkdir -p /mnt/data

Unmounting a File System

To detach a mounted file system, use the umount command followed by either the mount point directory or the device name:

txt
umount DIRECTORY
umount DEVICE_NAME

If the file system is in use, the umount command will fail to detach it. In those situations, you can use the fuser command to find out which processes are accessing the file system:

Terminal
fuser -m DIRECTORY

Once you determine the processes, you can stop them and unmount the file system.

Lazy Unmount

Use the -l (--lazy) option to unmount a busy file system as soon as it is no longer in use:

Terminal
umount -l DIRECTORY

Force Unmount

Use the -f (--force) option to force an unmount. This option is usually used to unmount an unreachable NFS system:

Terminal
umount -f DIRECTORY

Force unmounting is generally not a good idea, as it may corrupt data on the file system.

Quick Reference

CommandDescription
mountList all mounted file systems
mount -t ext4List mounted file systems of a specific type
sudo mount DEVICE DIRMount a device to a directory
sudo mount -t TYPE DEVICE DIRMount with an explicit file system type
sudo mount -o OPTIONS DEVICE DIRMount with specific options
sudo mount DIRMount using /etc/fstab entry
sudo mount /dev/sdd1 /media/usbMount a USB drive
sudo mount /path/to/image.iso /media/iso -o loopMount an ISO file
umount DIRECTORYUnmount by mount point
umount DEVICE_NAMEUnmount by device name
umount -l DIRECTORYLazy unmount (detach when not busy)
umount -f DIRECTORYForce unmount (use with caution)
fuser -m DIRECTORYFind processes using a mount point
lsblkList block devices and their mount points

Troubleshooting

“Permission denied” when mounting The mount command requires root privileges. Prefix the command with sudo, or add the device to /etc/fstab with the user option to allow non-root mounts.

“Device or resource busy” when unmounting A process is still accessing the file system. Run fuser -m DIRECTORY to identify the processes, then stop them before retrying umount. Alternatively, use umount -l for a lazy unmount.

“Wrong fs type, bad option, bad superblock” The file system type was not detected correctly. Specify it explicitly with the -t flag: sudo mount -t ext4 /dev/sdb1 /mnt/data.

Mount does not persist after reboot Mounts made with mount are not persistent. To mount a file system automatically at boot, add an entry to /etc/fstab.

“Can’t read superblock” on USB drive The drive may use a file system not supported by default (for example, exFAT). Install the required kernel module or FUSE driver, then retry the mount.

FAQ

What is the difference between mount and umount? mount attaches a file system to a directory in the tree, making its contents accessible at that path. umount detaches it, making the directory empty again.

Why is the command umount and not unmount? The command has been spelled umount since early Unix — it is a historical convention, not a typo.

How do I make a mount persistent across reboots? Add an entry to /etc/fstab. The format is: DEVICE MOUNTPOINT FSTYPE OPTIONS DUMP PASS. After editing the file, run sudo mount -a to test that all entries mount without errors.

What is a mount point in Linux? A mount point is a directory where a file system is attached and made accessible. After mounting, the mounted file system appears under that directory path.

How do I find the device name of a connected drive? Run lsblk to list all block devices and their mount points. You can also use fdisk -l or check dmesg output right after plugging in the device.

Can I mount a directory to another directory? Yes, using a bind mount: sudo mount --bind /source/dir /target/dir. This makes the contents of the source directory accessible at the target path without duplicating any data.

Conclusion

The mount command is the primary tool for attaching file systems in Linux, from local partitions and USB drives to ISO images and NFS shares. Use /etc/fstab to make mounts persistent across reboots, and umount to safely detach them when done. For NFS-specific setup, see the NFS mount guide .

Tags

Linuxize Weekly Newsletter

A quick weekly roundup of new tutorials, news, and tips.

About the authors

Dejan Panovski

Dejan Panovski

Dejan Panovski is the founder of Linuxize, an RHCSA-certified Linux system administrator and DevOps engineer based in Skopje, Macedonia. Author of 800+ Linux tutorials with 20+ years of experience turning complex Linux tasks into clear, reliable guides.

View author page