2018-11-12 11:32:24 +00:00
|
|
|
---
|
|
|
|
layout: page
|
|
|
|
category_title: Intermediate commands
|
|
|
|
category-page: intermediate
|
2018-11-15 14:22:25 +00:00
|
|
|
tags: mount drive umount storage device
|
2018-11-12 11:32:24 +00:00
|
|
|
author: Marco Farace
|
|
|
|
title: mount
|
|
|
|
---
|
2018-11-12 12:46:51 +00:00
|
|
|
To access a file on a Unix-like machine, the file system that contains it
|
|
|
|
needs to be mounted with the <code>mount</code> command. Mount is frequently used for
|
|
|
|
movable storage devices such as SD cards, DVDs, etc...<br>
|
2018-11-12 11:32:24 +00:00
|
|
|
|
|
|
|
The mount command instructs the operating system that a file system is ready to
|
|
|
|
use, and associates it with a particular point in the overall file system
|
|
|
|
hierarchy (its mount point) and sets options relating to its access. Mounting
|
|
|
|
makes file systems, files, directories, devices and special files available for
|
2018-11-12 12:46:51 +00:00
|
|
|
use and available to the user.<br>
|
2018-11-12 11:32:24 +00:00
|
|
|
|
2018-11-12 12:46:51 +00:00
|
|
|
Its counterpart, umount, does exactly the opposite.<br>
|
|
|
|
Both mount and umount require root user persmissions.<br>
|
|
|
|
To display all mounted partitions just write <code>mount</code>.<br>
|
2018-11-12 11:32:24 +00:00
|
|
|
|
2018-11-12 12:46:51 +00:00
|
|
|
This command will mount the second partition of a HDD:<br>
|
|
|
|
<pre>
|
|
|
|
mount /dev/hda2 /media/PHOTOS
|
2018-11-15 20:09:21 +00:00
|
|
|
</pre>
|
2018-11-12 11:32:24 +00:00
|
|
|
|
2018-11-12 12:46:51 +00:00
|
|
|
and will unmount (by referring to the physical disk partition):<br>
|
|
|
|
<pre>
|
|
|
|
umount /dev/hda2
|
2018-11-15 20:09:21 +00:00
|
|
|
</pre>
|
2018-11-12 11:32:24 +00:00
|
|
|
|
2018-11-12 12:46:51 +00:00
|
|
|
or (by referring to the mount point):<br>
|
|
|
|
<pre>
|
|
|
|
umount /media/PHOTOS
|
2018-11-15 20:09:21 +00:00
|
|
|
</pre>
|
2018-11-12 11:32:24 +00:00
|
|
|
|
2018-11-12 12:46:51 +00:00
|
|
|
<h3>Flags</h3>
|
|
|
|
<ul>
|
|
|
|
<li>-d: Causes everything to be done except for the actual system call.
|
|
|
|
This option is useful in conjunction with the -v flag to determine
|
|
|
|
what the mount command is trying to do.</li>
|
|
|
|
<li>-v: Verbose mode. (Gives additional detail during the mount process)</li>
|
|
|
|
<li>-f: Forces the revocation of write access when trying to downgrade a
|
|
|
|
filesystem mount status from read-write to read-only.</li>
|
|
|
|
<li>-u: The -u flag indicates that the status of an already mounted file
|
|
|
|
system should be changed. Any of the options discussed above
|
|
|
|
(the -o option) may be changed; also a file system can be changed
|
|
|
|
from read-only to read-write or vice versa. An attempt to change
|
|
|
|
from read-write to read-only will fail if any files on the
|
|
|
|
filesystem are currently open for writing unless the -f flag is
|
|
|
|
also specified.</li>
|
|
|
|
<li>-w: Mount the file system read-write.</li>
|
|
|
|
<li>-o: Options are specified with a -o flag followed by a comma separated
|
|
|
|
string of options. The following options are available:
|
|
|
|
<ul>
|
|
|
|
<li>noexec: Do not allow execution of any binaries on the mounted file system.
|
2018-11-12 11:32:24 +00:00
|
|
|
This option is useful for a server that has file systems containing
|
2018-11-12 12:46:51 +00:00
|
|
|
binaries for architectures other than its own.</li>
|
|
|
|
<li>noowners: Ignore the ownership field for the entire volume. This causes all
|
2018-11-12 11:32:24 +00:00
|
|
|
objects to appear as owned by user ID 99 and group ID 99. User ID 99
|
|
|
|
is interpreted as the current effective user ID, while group ID 99 is
|
2018-11-12 12:46:51 +00:00
|
|
|
used directly and translates to ``unknown''.</li>
|
|
|
|
<li>nobrowse: This option indicates that the mount point should not be visible via
|
|
|
|
the GUI (It will not appear on the Desktop as a separate volume).</li>
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
</ul>
|