The software described in this documentation is either in Extended Support or Sustaining Support. See https://www.oracle.com/us/support/library/enterprise-linux-support-policies-069172.pdf for more information.
Oracle recommends that you upgrade the software described by this documentation as soon as possible.
To access a file system's contents, you must attach its block device to a mount point in the directory hierarchy. You can use the mkdir command to create a directory for use as a mount point, for example:
# mkdir /var/projects
You can use an existing directory as a mount point, but its contents are hidden until you unmount the overlying file system.
The mount command attaches the device containing the file system to the mount point:
#mount
[options
]device
mount_point
You can specify the device by its name, UUID, or label. For
example, the following commands are equivalent ways of mounting
the file system on the block device /dev/sdb1
:
#mount /dev/sdb1 /var/projects
#mount UUID="ad8113d7-b279-4da8-b6e4-cfba045f66ff" /var/projects
#mount LABEL="Projects" /var/projects
If you do not specify any arguments, mount displays all file systems that the system currently has mounted, for example:
# mount
/dev/mapper/vg_host01-lv_root on / type ext4 (rw)
...
In this example, the LVM logical volume
/dev/mapper/vg_host01-lv_root
is mounted on
/
. The file system type is
ext4
and is mounted for both reading and
writing. (You can also use the command cat
/proc/mounts to display information about mounted file
systems.)
The df command displays information about home much space remains on mounted file systems, for example:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_host01-lv_root 36G 12G 22G 36% /
...
You can use the -B (bind) option to the
mount command to attach a block device at
multiple mount points. You can also remount part of a directory
hierarchy, which need not be a complete file system, somewhere
else. For example, the following command mounts
/var/projects/project1
on
/mnt
:
# mount -B /var/projects/project1 /mnt
Each directory hierarchy acts as a mirror of the other. The same files are accessible in either location, although any submounts are not replicated. These mirrors do not provide data redundancy.
You can also mount a file over another file, for example:
#touch /mnt/foo
#mount -B /etc/hosts /mnt/foo
In this example, /etc/hosts
and
/mnt/foo
represent the same file. The existing
file that acts as a mount point is not accessible until you
unmount the overlying file.
The -B option does not recursively attach any submounts below a directory hierarchy. To include submounts in the mirror, use the -R (recursive bind) option instead.
When you use -B or -R, the file system mount options remain the same as those for the original mount point. To modify, the mount options, use a separate remount command, for example:
# mount -o remount,ro /mnt/foo
You can mark the submounts below a mount point as being shared, private, or slave:
-
mount --make-shared
mount_point
Any mounts or unmounts below the specified mount point propagate to any mirrors that you create, and this mount hierarchy reflects mounts or unmount changes that you make to other mirrors.
-
mount --make-private
mount_point
Any mounts or unmounts below the specified mount point do not propagate to other mirrors, nor does this mount hierarchy reflect mounts or unmount changes that you make to other mirrors.
-
mount --make-slave
mount_point
Any mounts or unmounts below the specified mount point do not propagate to other mirrors, but this mount hierarchy does reflect mounts or unmount changes that you make to other mirrors.
To prevent a mount from being mirrored by using the -B or -R options, mark its mount point as being unbindable:
# mount --make-unbindable mount_point
To move a mounted file system, directory hierarchy, or file between mount points, use the -M option, for example:
#touch /mnt/foo
#mount -M /mnt/foo /mnt/bar
To unmount a file system, use the umount command, for example:
# umount /var/projects
Alternatively, you can specify the block device provided that it is mounted on only one mount point.
For more information, see the mount(8)
and
umount(8)
manual pages.