Skip to content

mount Linux Command Guide

The Linux mount command is used to attach a filesystem to the system’s file hierarchy. It is essential for managing storage devices and network shares. With various options available, the mount command allows users to control how and where the filesystem is mounted. By using this command, users can access files and directories stored on different devices as if they were part of the local filesystem.

mount Syntax:

Terminal window
mount [options] device directory

Options:

OptionDescription
-aMount all filesystems mentioned in /etc/fstab
-tSpecify the filesystem type to be mounted
-oSpecify mount options
-rMount the filesystem read-only
-wMount the filesystem read-write
-nMount without writing to /etc/mtab (temporary mount)

Parameters:

ParameterDescription
deviceThe device to mount
directoryThe directory where the device is mounted

mount Command Samples:

Mounting a USB Drive

Terminal window
mount /dev/sdb1 /mnt/usb

Mounts the USB drive located at /dev/sdb1 to the /mnt/usb directory.

Mount Network File System (NFS) Share

Terminal window
mount -t nfs 192.168.1.100:/shared /mnt/nfs

Mounts an NFS share from the server with IP address 192.168.1.100 to the /mnt/nfs directory.

Mount ISO File as Loop Device

Terminal window
mount -o loop ~/Downloads/ubuntu.iso /mnt/iso

Mounts the Ubuntu ISO file located in the home directory as a loop device to the /mnt/iso directory.

Bind Mount a Directory

Terminal window
mount --bind /srv/data /mnt/data

Creates a bind mount of the /srv/data directory within the /mnt/data directory.

Mount Encrypted File System

Terminal window
mount -t ecryptfs ~/encrypted ~/private

Mounts an encrypted file system located at ~/encrypted to the ~/private directory using ecryptfs.

Mounting a FAT32 File System

Terminal window
mount -t vfat /dev/sdc1 /mnt/fat32

Mounts the FAT32 file system on /dev/sdc1 to the /mnt/fat32 directory.

Mounting a Windows Share

Terminal window
mount -t cifs //server/share /mnt/windows -o username=user,password=pass

Mounts a Windows share from the server to the /mnt/windows directory with specified username and password.

mount FAQ:

How do I use mount in Linux?

To use the mount command in Linux, execute the following command:

Terminal window
mount --option <value>

How can I mount a specific device to a directory in Linux?

To mount a specific device to a directory in Linux, use the following command:

Terminal window
mount /dev/sdb1 /mnt/data

How do I list all currently mounted filesystems in Linux?

To list all currently mounted filesystems in Linux, you can use the following command:

Terminal window
mount

How can I mount a network share in Linux using the mount command?

To mount a network share in Linux using the mount command, you can use a command similar to this:

Terminal window
mount -t cifs //server/share /mnt/network -o username=user,password=pass

How do I unmount a filesystem in Linux?

To unmount a filesystem in Linux, you can use the following command:

Terminal window
umount /mnt/data

How can I mount a filesystem with read-only permissions in Linux?

To mount a filesystem with read-only permissions in Linux, use the following command:

Terminal window
mount -o ro /dev/sdc1 /mnt/readonly

Applications of the mount command

  • Mounting a filesystem
  • Mounting a remote directory
  • Mounting a CD or DVD
  • Mounting a USB drive
  • Mounting a network share
  • Mounting a disk image