Mounting File Systems

Source: Internet
Author: User

1.Mounting File Systems

Just creating a partition and putting a file system on it are not enough to start using it. To use a partition, you have to mount it as well. By mounting a partition (or better, the "file system on it"), you make its contents accessible through a specific directory.
To mount a file system, some information is needed:
What to mount:this information are mandatory and specifies the name of the device that needs to be mounted.
Where to Mount It:this are also mandatory information which specifies the directory on which the device should be mounte D.
What is the file system to mount:optionally, can specify the file system type.in the most cases, this is not necessary. The Mount command would detect which file system is used on the device and make sure the correct driver is used.
Mount Options:many mount options can be used when mounting a device. The Using options are optional and depends on the needs and the file system.
Manually mounting file Systems To manually mount a file system with the Mount command is used. To disconnect a mounted file system, the Umount command is used. Using These commands is relatively easy. To mount the file system, the "On/dev/vda5 on the Directory/mnt", use the following command:
mount/dev/vda5/mnt
To disconnect the mount, you can use Umount with either the name of the device or the name of the mount point you want Disconnect. So, both of the following commands would work:Umount/dev/vda5 umount/mnt
Using Device Names, UUIDs, or Disk Labels

To mount a device, the name of the device can is used, as in the Command/dev/vda5. If your server is used in an environment where a dynamic storage topology is used, the "not always" the best approach. May today has a storage device/dev/sda5, which after changes in the storage topology can BE/DEV/SDB5 after the NEX T reboot of your server. This is what on a default RHEL 7 installation UUIDs is used instead of device names. Every file system by default have a UUID associated to it, not just file systems is used to the store files but also spec Ial file systems such as the swap file system. You can use the blkid command to get a overview of the current file systems in your system and the UUID is Used by that file system.

[[Email protected] ~]# Blkid/dev/sda1:uuid="2f8b9056-1129-4bea-bb94-bc2f7f8de206"Type="XFS"/dev/sda2:uuid="Ojqvzk-ks1b-yegw-zb4b-uanv-zgt7-npfsju"Type="Lvm2_member"/dev/sdb1:uuid="f4a212cd-211f-4ddd-84ed-18ede66505ff"Type="Ext4"/dev/sdc1:uuid="b74fbc00-3f2e-4dea-99da-a17de3f798c3"Type="Swap"/dev/mapper/rhel-root:uuid="4119798b-4939-48f4-be1a-3f3de1f8e934"Type="XFS"/dev/mapper/rhel-swap:uuid="8A1F616F-989D-4846-A961-EE5EA2BC32BF"Type="Swap" 

Mount Uuid= "42f419c4-633f-4ed7-b161-519a4dadd3da"/mnt --mount device with UUID
Manually mounting devices using the UUID is not exactly easier. If mounts is automated as discussed in the next sections, however, it does make sense using UUIDs instead of device names.

2. Automating File System Mounts through/etc/fstab

[Email protected] ~]# cat/etc/Fstab # #/etc/fstab# Created by Anaconda on Tue June -  A: -: $  .# # Accessible filesystems, by reference, is maintained under'/dev/disk'# See mans pages Fstab (5), Findfs (8), Mount (8) and/or Blkid (8) forMore info#/DEV/MAPPER/RHEL-ROOT/XFS defaults0 0UUID=2f8b9056-1129-4bea-bb94-bc2f7f8de206/boot XFS Defaults0 0/dev/mapper/rhel-swap Swap swap Defaults0 0#added by rusky:used fortesting./dev/sdb1/testdisk EXT4 Defaults0 0

In The/etc/fstab file, everything are specified to mount the file system automatically. For the purpose, every line has six fields, as summarized in Table 14.5.

Notice that the mount point is not all file systems use a directory name. Some system devices such as swap is not mounted in a directory, but on a kernel interface. It's easy-to-recognize when a kernel interface is used;   Its name is does not to start with a/(and does not exist in the file system on your server). The Mount options field defines specific Mount options that can be used. If no specific options is required, this line would just read "defaults."  To offer specific functionality, a large number of the mount options can be specified here. Table 14.6 gives an overview of some of the more common mount options.

The fifth Column Of/etc/fstab specifies support for the dump utility. This is a utility the is developed to create file system backups. It is good practice to switch this feature on by specifying a 1 for all real file systems, and switch it off by specifying 0 for all system mounts. The last column indicates if the file system integrity needs to is checked while booting. Put A 0 if you don't want to check the file system at all, a 1 if the-the root file system which needs to be CHEC Ked before anything else, and a 2 if this is a nonroot the file system, needs to being checked while booting.

Mounting File Systems

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.