mountpoint(1)
| MOUNTPOINT(1) | Linux System Administrator's Manual | MOUNTPOINT(1) |
NAME
mountpoint - see if a directory is a mountpoint
SYNOPSIS
/bin/mountpoint [-q] [-d]
/path/to/directory
/bin/mountpoint -x /dev/device
DESCRIPTION
Mountpoint checks if the directory is a mountpoint.
OPTIONS
- -q
- Be quiet - don't print anything.
- -d
- Print major/minor device number of the filesystem on stdout.
- -p
- Check Linux's /proc/mounts file to try to detect circular mount points.
- -x
- Print major/minor device number of the blockdevice on stdout.
EXIT STATUS
Zero if the directory is a mountpoint, non-zero if not.
NOTES
Symbolic links are not followed, except when the -x option is used. To force following symlinks, add a trailing slash to the path of the directory.
The name of the command is misleading when the -x option is used, but the option is useful for comparing if a directory and a device match up, and there is no other command that can print the info easily.
The mountpoint command fails when a directory is binded to one of its grandparents. For example, if /a/b/c/d is a mount point for /a/b then mountpoint will report /a/b/c/d is not a valid mount point. This is because both the original directory and its new mount point share the same inode and device number.
The circular mount problem can be worked around on Linux systems by using the -p flag to check the /proc/mounts file for references to the circular mount bind. When using the -p flag, make sure to specify the full path (ie /home/user/mp and not just mp). Also, mountpoint may still fail if there are spaces in the mount point's path, even when using the -p flag because of the way /proc/mounts mangles the spaces in the path name. Of course, if the admin is using circular mount points with spaces in the name, there are bigger concerns.
AUTHOR
Miquel van Smoorenburg, miquels@cistron.nl
SEE ALSO
| March 15, 2004 |
