Linux mount command
The Linux mount command is a frequently used command that is used to mount files outside the Linux system.
Syntax
mount [-hV] mount -a [-fFnrsvw] [-t vfstype] mount [-fnrsvw] [-o options [,...]] device | dir mount [-fnrsvw] [-t vfstype] [-o options] device dir
Parameter description:
- -V: Displays the program version.
- -h: Displays auxiliary information.
- -v: Displays more detailed information, usually used with -f for debugging.
- -a: Mounts all file systems defined in /etc/fstab.
- -F: This command is usually used together with -a. It generates a process for each mount action to execute. When the system needs to mount a large number of NFS file systems, it can speed up the mounting process.
- -f: Usually used for debugging. It causes mount not to actually perform the mounting action, but to simulate the entire mounting process. Usually used with -v.
- -n: Generally, mount writes an entry to /etc/mtab after mounting. However, this option can cancel this action when no writable file system exists in the system.
- -s-r: equals -o ro
- -w: equals -o rw
- -L: Mounts the hard disk partition with a specific label.
- -U: Mounts the file system whose partition sequence number is . -L and -U are meaningful only when files such as /proc/partition exist.
- -t: Specifies the file system type. Usually it does not need to be specified; mount will automatically select the correct type.
- -o async: Turns on asynchronous mode. All file read and write actions will be performed in asynchronous mode.
- -o sync: Performs in synchronous mode.
- -o atime, -o noatime: When atime is turned on, the system updates the file's "last access time" every time the file is read. When using a flash file system, you may choose to turn this option off to reduce the number of writes.
- -o auto, -o noauto: Turns automatic mounting mode on/off.
- -o defaults: Uses the default options rw, suid, dev, exec, auto, nouser, and async.
- -o dev, -o nodev-o exec, -o noexec allows executables to be executed.
- -o suid、-o nosuid:
- Allow executables to be executed with root privileges.
- -o user, -o nouser: Users can perform mount/umount actions.
- -o remount: Remounts an already mounted file system in a different way. For example, a system that was originally read-only can be remounted in read-write mode.
- -o ro: Mounts in read-only mode.
- -o rw: Mounts in read-write mode.
- -o loop=: Uses loop mode to mount a file onto the system as if it were a hard disk partition.
Examples
Mount /dev/hda1 under /mnt.
#mount /dev/hda1 /mnt
Mount /dev/hda1 under /mnt in read-only mode.
#mount -o ro /dev/hda1 /mnt
Mount the CD image file /tmp/image.iso under /mnt/cdrom using loop mode. In this way, you can view the contents of Linux CD ISO files commonly found on the network without burning them to a CD.
#mount -o loop /tmp/image.iso /mnt/cdromOther extensions
Linux Command Encyclopedia