Sobes.tech
Junior

What options are available for mounting file systems?

sobes.tech AI

Answer from AI

  • -o: Specifies mount options. Multiple options can be listed separated by commas.
  • defaults: Uses default options from /etc/fstab or basic system options (rw, suid, dev, exec, auto, nouser, async).
  • rw: Mounts the filesystem in read-write mode.
  • ro: Mounts the filesystem as read-only.
  • auto: Allows the filesystem to be mounted at boot with mount -a.
  • noauto: Prevents automatic mounting at boot.
  • exec: Permits execution of binary files on the filesystem.
  • noexec: Prohibits execution of binary files on the filesystem, useful for mounting directories with user content, e.g., /tmp or /var/www.
  • suid: Allows use of setuid and setgid bits.
  • nosuid: Disallows use of setuid and setgid bits.
  • dev: Permits interpretation of special devices on the filesystem.
  • nodev: Disallows interpretation of special devices.
  • sync: All write operations to the buffer will be performed synchronously.
  • async: All write operations to the buffer will be performed asynchronously. This is the default option.
  • user: Allows a regular user to mount the filesystem.
  • nouser: Only root can mount the filesystem. This is the default option.
  • remount: Remounts an already mounted filesystem, allowing option changes without unmounting.
  • bind: Mounts part of the directory hierarchy elsewhere.
    # Example of using bind
    mount --bind /source/path /target/path
    
  • loop: Mounts a file as a block device. Usually used for disk images or ISO files.
    # Example of using loop
    mount -o loop image.iso /mount/point
    
  • dirsync: All directory updates on the filesystem will be performed synchronously.
  • noatime: Does not update the last access time of a file (atime). Can improve performance on intensive read operations.
  • relatime: Updates atime only if the previous atime was earlier than the current mtime or ctime of the file. Default option for many filesystems.
  • strictatime: Always updates atime on each access to a file.

Example of a mount command with multiple options:

# Mount the sdb1 partition to /mnt/data with rw,noexec options
mount -o rw,noexec /dev/sdb1 /mnt/data