Mount Usage Details

Source: Internet
Author: User

In addition to mounting a Local Machine (hard disk, USB memory, CD, DVD, etc.) or a remote (NFS, Samba, etc.) file system, the mount command can also view the mounted file system. The following example uses the mount command to list mounted file systems: $ mount to list mounted remote and local file systems/dev/sda7 on/type ext3 (rw) proc on/proc type proc (rw) sysfs on/sys type sysfs (rw) devpts on/dev/pts type devpts (rw, gid = 5, mode = 620) /dev/sda6 on/mnt/debian type ext3 (rw)/dev/sda3 on/mnt/slackware type ext3 (rw) tmpfs on/dev/shm type tmpfs (rw) none on/proc/sys/fs/binfmt_misc type binfmt_misc (rw) sunrpc on/var/lib/nfs/rpc_pipefs type r Pc_pipefs (rw) can use the-t option to list the mounting conditions of the specified file system type only: $ mount-t ext3 list mounted ext3 file systems/dev/sda7 on/type ext3 (rw)/dev/sda6 on/mnt/debian type ext3 (rw) /dev/sda3 on/mnt/slackware type ext3 (rw) use the-l option to display the mounting information and partition labels together: $ mount-t ext3-l list mounted ext3 file systems and labels/dev/sda7 on/type ext3 (rw) [/123]/dev/sda6 on/mnt/debian type ext3 (rw) [/mnt/debian]/dev/sda3 on/mnt/slackware type ext3 (rw) [/mnt/slackware] It is relatively simple to use the mount command to mount the/dev/sda1 device to an existing Directory/mnt/mymount: # mount/dev/sda1/mnt/mymount/mount the local file system # mount-v/dev/sda1/mnt/mymount/same as above, and output detailed information mount: you didn't specify a filesystem type for/dev/sda1 I will try type ext3/dev/sda1 on/mnt/mymount type ext3 (rw) in this example, the mount command searches for/dev/sda1 related entries in the/etc/fstab file or tries to guess the file system type. You can use the-t option to specify the type of the file system to be mounted: # mount-v-t ext3/dev/sda1/mnt/mymount/mount ext3 File System/dev/sda1 on/mnt/mymount type ext3 (rw) In addition, you can also display the label/Name of the Mount partition: # mount-vl-t ext3/dev/sda1/mnt/mymount/mount file system/display labels if the partition to be mounted is already listed in the fstab file, you only need to specify the mount point or device. Take the following fstab entry as an example:/dev/sda1/mnt/mymount ext3 defaults 1 2 can mount the file system using the following two commands: # mount-v/dev/sda1 mount the file system/dev/sda1 on/mnt/mymount type ext3 (rw) with the device name only) # mount-v/mnt/mymount/mount the file system with the mount point only/dev/sda1 on/mnt/mymount type ext3 (rw) you can use the-o option and a comma-separated option to specify the mount option, which is equivalent to the 4th fields in the/etc/fstab file. By default, read/write access is supported after the partition is mounted. In addition, you can specify to mount the file system in read/write (rw) or read-only (ro) mode: # mount-v-t ext3-o rw/dev/sda1/mnt/mymount/read/write mount/dev/sda1 on/mnt/mymount type ext3 (rw) # mount-v-t ext3-o ro/dev/sda1/mnt/mymount/read-only mounting/dev/sda1 on/mnt/mymount type ext3 (ro) other useful mount options include the following. Noatime -- Do not update the file access time. It is advantageous for file systems that execute a large number of I/O operations (such as mail pools and logs. Noexec -- the execution of binary files in the file system is not allowed. It is used to improve security. For example, it is used on/tmp with an untrusted user environment. Remount -- modify the option of the mounted file system. With remount, You Can unmount the file system with only one command and remount the file system with the new option. In the following example, the previously read/write Mounting Mode is changed to read-only: # mount-v-o remount, ro/dev/sda1/dev/sda1 on/mnt/mymount type ext3 (ro) -- bind -- mount the mounted file system to another location in the directory tree. If/dev/sda1 has been mounted to/mnt/mymount, type the following command: # mount -- bind-v/mnt/mymount // tmp/mydir // mnt/mymount on/tmp/mydir type none (rw, bind) now you can access the same file system from both locations. The new mount point and the original mount point have the same mount options. -- Move -- migrate the file system from one mount point to another. Assuming that/dev/sda1 has been mounted to/mnt/mymount, the following command will migrate the file system to the/tmp/mydir directory: # mount-v -- move/mnt/mymount/tmp/mydir/mnt/mymount on/tmp/mydir type none (rw) in the file, not only can the swap zone be created, you can also create a file system and mount the file in the loop mode. The preceding section 7.2.3 describes how to create and mount such files. After downloading the Linux installation CD or LiveCD, files usually need to be mounted in the loop mode, which is also common. After attaching a CD image as a loop, you can view the content or copy the file to the hard disk. In the following example, when the CD image file is mounted (the file system type is iso9660), the mount command automatically selects an existing loopback device. The command output displays/dev/loop0: # mount-v-t iso9660-o loop/tmp/myimage. iso/mnt/mymount/mount: going to use the loop device/dev/loop0/tmp/myimage. iso on/mnt/mymount type ext3 (rw, loop =/dev/loop0) in the following example, assume that the Fedora USB flash drive Boot Image diskboot is downloaded. img and save it in the/tmp directory. Run the following command to mount the Boot Image: # mount-v-o loop/tmp/diskboot. img/mnt/mymount mount: going to use the loop device/dev/loop0 mount: you didn't specify a filesystem type for/dev/loop0 I will try type vfat/tmp/diskboot. img on/mnt/mymount type vfat (rw, loop =/dev/loop0) use the losetup command to view the status of the loop device: # losetup-a list mounted loopback devices/dev/loop0: [0807]: 1009045 (/tmp/diskboot. img) if the recyclically mounted device fails to be uninstalled, use the following command to detach the device: # losetup-d/dev/loop1 to forcibly detach the mounted device.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.