Linux mount command
The Linux mount command is frequently used; it 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: Display the program version
- -h: Display help information
- -v: Display more information, usually used with -f for debugging.
- -a: Mount all file systems defined in /etc/fstab.
- -F: This command is usually used together with -a; it spawns a process for each mount action to execute it. It can speed up mounting when the system needs to mount a large number of NFS file systems.
- -f: Usually used for debugging. It makes mount not perform the actual mounting action, but simulate the entire mounting process. It is usually used together with -v.
- -n: Generally, mount writes an entry in /etc/mtab after mounting. But when there is no writable file system on the system, you can use this option to cancel this action.
- -s-r: Equivalent to -o ro
- -w: Equivalent to -o rw
- -L: Mount the hard disk partition with a specific label.
- -U: Mount the file system whose partition serial number is given. -L and -U are only meaningful when a file like /proc/partition exists.
- -t: Specify the type of file system; usually it does not need to be specified, as mount will automatically select the correct type.
- -o async: Enable asynchronous mode; all file read/write operations are performed asynchronously.
- -o sync: Execute in synchronous mode.
- -o atime, -o noatime: When atime is enabled, the system updates the file's "last access time" each time the file is read. When using a flash file system, you may choose to disable this option to reduce the number of writes.
- -o auto, -o noauto: Enable/disable automatic mount mode.
- -o defaults: Use the default options rw, suid, dev, exec, auto, nouser, and async.
- -o dev, -o nodev, -o exec, -o noexec Allow or disallow execution of executable files.
- -o suid, -o nosuid:
- Allow executable files to run with root privileges.
- -o user, -o nouser: Allow users to perform mount/umount operations.
- -o remount: Remount 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: Mount in read-only mode.
- -o rw: Mount in read-write mode.
- -o loop=: Use loop mode to mount a file as if it were a hard disk partition.
Example
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 disc image file /tmp/image.iso under /mnt/cdrom using loop mode. This method allows you to view the contents of a Linux disc ISO file found on the Internet without burning it to a disc.
#mount -o loop /tmp/image.iso /mnt/cdrom
Linux Command Reference