The Linux mount command is often 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 the secondary message.
- -V: displays more information, usually used with-f for debugging.
- -A: Mount all file systems defined in/etc/fstab.
- -F: this command is usually used with-a, which generates a route for each mount action. You can speed up mounting when the system needs to mount a large number of NFS file systems.
- -F: used for debugging. It will make the mount not execute the actual action, but simulate the entire process of mounting. It is usually used with-v.
- -N: In general, after mount is mounted, a piece of information is written into the/etc/mtab. However, you can use this option to cancel this operation if the file system does not exist.
- -S-r: equal to-o ro
- -W: equal to-o rw
- -L: Separate hard disks with specific tags.
- -U: the file system that splits the file into sequence numbers. -L and-U must exist in the/proc/partition file to make sense.
- -T: specifies the type of the file system, which is usually not required. Mount automatically selects the correct type.
- -O async: In non-synchronous mode, all file read and write operations are performed in non-synchronous mode.
- -O sync: Run in synchronization mode.
- -O atime and-o noatime: when atime is enabled, the system updates the "last call time" of the file each time the file is read 』. When we use the flash file system, we may choose to disable this option to reduce the number of writes.
- -O auto and-o noauto: enable/disable the automatic mode.
- -O defaults: use the default options rw, suid, dev, exec, auto, nouser, and async.
- -O dev,-o nodev-o exec, and-o noexec allow execution files to be executed.
- -O suid and-o nosuid:
- The execution file can be executed with the root permission.
- -O user and-o nouser: The user can perform the mount/umount action.
- -O remount: Re-attaches an existing file system in different ways. For example, a previously read-only system can be re-mounted in the read-write mode.
- -O ro: hangs in read-only mode.
- -O rw: Applicable to read/write mode.
- -O loop =: The loop mode is used to separate an archive into a hard disk and mount it to the system.
Instance
Mount/dev/hda1 under/mnt.
# Mount/dev/hda1/mnt
Mount/dev/hda1 in read-only mode under/mnt.
# Mount-o ro/dev/hda1/mnt
Mount the image file of the/tmp/image. iso disc in loop mode under/mnt/cdrom. In this way, you can view the Linux optical disc ISO files that can be found on the network without burning them into CDs.
# Mount-o loop/tmp/image. iso/mnt/cdrom