mount — stdin stdout - file -- opt --help --version
mount [options
]device
|directory
The mount
command makes a
partition accessible. Most commonly it handles disk drives (say,
/dev/sda1) and removal media
(e.g., USB keys), making them accessible via an existing directory
(say, /mnt/mydir):
# mkdir /mnt/mydir # ls /mnt/mydir Notice it’s empty # mount /dev/sda1 /mnt/mydir # ls /mnt/mydir file1 file2 file3 Files on the mounted partition # df /mnt/mydir Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda1 1011928 285744 674780 30% /mnt/mydir
mount
has tons of options
and uses; we will discuss only the most basic.
In most common cases, mount
reads the file /etc/fstab
(filesystem table) to learn how to mount a desired disk. For
example, if you type mount /usr, the mount
command looks up “/usr” in /etc/fstab, whose line might look like
this:
/dev/sda8 /usr ext3 defaults 1 2
Here mount
learns, among
other things, that disk device /dev/sda8 should be mounted on /usr as a Linux ext3-formatted
filesystem. Now you can mount /dev/sda8 on /usr with either of these commands:
# mount /dev/sda8 by device # mount /usr by directory
mount
is run typically by
the superuser, but common devices like USB and CD-ROM drives often
can be mounted and unmounted by any user.
$ mount /media/cdrom
|
Specify the type of
filesystem, such as |
|
List all mounted
filesystems; works with |
|
Mount all filesystems
listed in /etc/fstab.
Ignores entries that include the |
|
Mount the filesystem read-only (but see the manpage for some disclaimers). |
3.15.25.32