___________ __________ _____ ________ ________ .____ ___________ \_ _____/ \______ \ / _ \ / _____/ / _____/ | | \_ _____/ | __) | _/ / /_\ \ / \ ___ / \ ___ | | | __)_ | \ | | \ / | \ \ \_\ \ \ \_\ \ | |___ | \ \___ / |____|_ / \____|__ / \______ / \______ / |_______ \ /_______ / \/ \/ \/ \/ \/ \/ \/

mount Cheatsheet

← Back to cheatsheets

← Home


mount attaches a filesystem to the directory tree. Essential for accessing disks, partitions, network shares, and other storage devices.


Basic Usage

  • mount - List all mounted filesystems
  • mount /dev/sda1 /mnt - Mount device
  • mount -t type /dev/sda1 /mnt - Specify filesystem type
  • umount /mnt - Unmount filesystem
  • umount -l /mnt - Lazy unmount

Common Options

  • -t type - Filesystem type (ext4, ntfs, vfat, etc.)
  • -o options - Mount options (comma-separated)
  • -a - Mount all filesystems in /etc/fstab
  • -r - Mount read-only
  • -w - Mount read-write
  • -v - Verbose output
  • -n - Don't write to /etc/mtab
  • -f - Fake mount (don't actually mount)
  • -l - Show labels
  • -h - Show help

Mount Options

  • ro - Read-only
  • rw - Read-write
  • noexec - Don't allow execution
  • nosuid - Ignore setuid bits
  • nodev - Don't interpret device files
  • sync - Synchronous I/O
  • async - Asynchronous I/O
  • atime - Update access time
  • noatime - Don't update access time
  • relatime - Relative access time
  • remount - Remount filesystem
  • bind - Bind mount
  • loop - Loop device
  • user - Allow users to mount
  • users - Allow any user to mount/unmount
  • nouser - Only root can mount
  • defaults - Default options (rw,suid,dev,exec,auto,nouser,async)

Common Examples

List Mounts

mount

Show all mounted filesystems.

Mount Device

mount /dev/sda1 /mnt

Mount partition to directory.

Mount with Type

mount -t ext4 /dev/sda1 /mnt

Specify filesystem type.

Mount Read-Only

mount -r /dev/sda1 /mnt

Mount as read-only.

Mount with Options

mount -o ro,noexec /dev/sda1 /mnt

Mount with specific options.

Bind Mount

mount --bind /old/path /new/path

Create bind mount.

Mount Loop Device

mount -o loop image.iso /mnt

Mount ISO file.

Remount

mount -o remount,ro /mnt

Remount with new options.

Mount All

mount -a

Mount all filesystems from /etc/fstab.

Unmount

umount /mnt

Unmount filesystem.


Filesystem Types

  • ext2, ext3, ext4 - Linux extended filesystems
  • xfs - XFS filesystem
  • btrfs - Btrfs filesystem
  • vfat, fat32 - FAT filesystems
  • ntfs - NTFS filesystem
  • iso9660 - CD/DVD filesystem
  • nfs - Network File System
  • cifs, smbfs - SMB/CIFS filesystem
  • tmpfs - Temporary filesystem
  • proc - Proc filesystem
  • sysfs - Sysfs filesystem
  • devtmpfs - Device filesystem

Tips

  • Use mount to list current mounts
  • Use -t to specify filesystem type
  • Use -o for mount options
  • Use umount to unmount (not unmount)
  • Use -l for lazy unmount if busy
  • Check /etc/fstab for permanent mounts
  • Essential for disk management
  • Use mount -a to mount all from fstab