- Red Hat Enterprise Linux (RHEL)
- How to determine full mount options for a mounted file system ?
defaultsprovides an alias for
async,auto,dev,exec,nouser,rw,suid, then why these options not reported in
- If the filesystem is mounted with one of the option in
defaults, do other options are applicable ?
- For example,
tmpfsfilesystem as below :
tmpfs /dev/shm tmpfs defaults 0 0
# mount -v -t tmpfs tmpfs on /dev/shm type tmpfs (rw)
# cat /proc/mounts | grep tmpfs tmpfs /dev/shm tmpfs rw,seclabel,nosuid,nodev 0 0
For tmpfs, the only filesystem options that are displayed are :
- size=SIZE (if the size is not default)
- nr_inodes=INODES (if the number is not the default)
- mode=MODE (if the mode is not the default)
- uid=UID (if the uid is not 0/root)
- gid=GID (if the gid is not 0/root)
- memory policy (if not default)
rwis displayed for all filesystem types.
- Some mount options are only displayed if they are not the default.
- The most complete location to view the mount options is in
/proc/self/mountsin RHEL 5 and
/proc/self/mountinfoin RHEL 6
- For most filesystems, the mount options are only displayed in /proc/mounts if :
- they are applicable to the particular filesystem type
- they are not strictly for internal use
- the mount options are not the default setting
- the user has the appropriate capabilities to show the options (CAP_SYS_ADMIN) in the current mount namespace
 On a test system, edit fstab to mount tmpfs with
rw only and performed a reboot :
# cat /etc/fstab | grep tmpfs tmpfs /dev/shm tmpfs rw 0 0 # cd /dev/shm/ # cat > script.sh #!/bin/bash echo "Script ran" # chmod u+x script.sh # ./script.sh Script ran
- Result : Script ran, though
 Now, edit fstab to mount tmpfs with
rw,noexec and performed a reboot :
# cat /etc/fstab | grep tmpfs tmpfs /dev/shm tmpfs rw,noexec 0 0 # cd /dev/shm/ # cat > script.sh #!/bin/bash echo "Script ran" # ls -l total 4 -rw-r--r--. 1 root root 30 Apr 6 00:47 scripts.sh # chmod u+x script.sh chmod: cannot access `script.sh': No such file or directory
Result : Unable to set execute permission, as
noexecis set explicitly.
For example, mounting a filesystem with
rw,execoptions, will also mount the filesystem with
- But, if any of these option is unset explicitly, it will not be applicable.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.