mount Command

The mount command in Linux is used to attach a filesystem to a specified mount point (a directory) in the filesystem tree. This makes the files and directories on the storage device accessible to the operating system and users. It's a crucial command for interacting with various storage media, including hard drives, SSDs, USB drives, CD/DVD-ROMs, and network shares.

Syntax

mount [-t type] [-o options] device directory

Description

When a filesystem is mounted, the contents of the device become accessible through the mount point. The mount command essentially tells the operating system that the filesystem on a particular device is available at a specific location in the directory hierarchy. Conversely, umount detaches the filesystem.

Common uses include:

  • Mounting removable media (USB drives, external hard drives).
  • Mounting partitions of internal hard drives.
  • Mounting network filesystems (NFS, SMB/CIFS).
  • Making ISO images accessible as virtual disks.

Common Options

Option Description
-a, --all Mount all filesystems mentioned in /etc/fstab.
-t, --types <type> Specify the filesystem type (e.g., ext4, vfat, ntfs, nfs).
-o, --options <options> Specify mount options (e.g., ro, rw, noexec, loop).
-r, --read-only Mount the filesystem as read-only.
-w, --read-write Mount the filesystem as read-write (default).
-L <label> Mount the partition that has the specified label.
-U <uuid> Mount the partition that has the specified UUID.

Examples

Mount a USB drive

sudo mkdir /mnt/usb_drive
sudo mount /dev/sdb1 /mnt/usb_drive

Creates a mount point and mounts the first partition of a USB drive.

Mount an ISO image

sudo mkdir /mnt/iso
sudo mount -o loop my_image.iso /mnt/iso

Mounts an ISO file as a loop device, making its contents accessible.

Mount a network file system (NFS) share

sudo mkdir /mnt/nfs_share
sudo mount -t nfs 192.168.1.100:/shared_folder /mnt/nfs_share

Mounts an NFS share from a remote server.

Remount a filesystem as read-only

sudo mount -o remount,ro /dev/sda1

Changes an already mounted filesystem to read-only mode.

List all mounted filesystems

mount
# Or:
findmnt

Displays a list of all currently mounted filesystems.

See also