Name
mount [options
] device
| directory
— mount
Synopsis
/bin
stdin stdout - file -- opt --help --version
The mount
command makes a hardware storage device accessible. Most commonly it handles disk devices (say, /dev/hda1), making them accessible via an existing directory (say, /mnt/mydir):
# mkdir /mnt/mydir # mount /dev/hda1 /mnt/mydir # df /mnt/mydir Filesystem 1K-blocks Used Available Use% Mounted on /dev/hda1 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 the “/usr” line in /etc/fstab, which might look like this:
/dev/hda8 /usr ext3 defaults 1 2
Here mount
learns, among other things, that disk device /dev/hda8 should be mounted on /usr as a Linux ext3-formatted filesystem.[13]
mount
is run typically by the superuser, but common devices like floppy and CD-ROM drives often can be mounted and unmounted by any user.
$ mount /mnt/cdrom $ mount /mnt/floppy
[13] Alternatively, you can use the -t
option of mount
to specify the filesystem type directly, such as mount -t ext3 /dev/hda1 /mnt/mydir
. See man mount
.
Get Linux Pocket Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.