1.Mounting File Systems

Just creating a partition and putting a file system on it is 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 is mandatory and specifies the name of the device that needs to be mounted.
■ Where to mount it: This is also mandatory information which specifies the directory on which the device should be mounted.
■ What file system to mount: Optionally, you can specify the file system type. In most cases, this is not necessary. The mount command will 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. Using options is optional and depends on the needs you may have with the file system.
Manually Mounting File Systems To manually mount a file system, 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 that is 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 to disconnect. So, both of the following commands will work: umount /dev/vda5 umount /mnt
Using Device Names, UUIDs, or Disk Labels

To mount a device, the name of the device can be used, as in the command /dev/ vda5. If your server is used in an environment where a dynamic storage topology is used, this is not always the best approach. You may today have a storage device /dev/ sda5, which after changes in the storage topology can be /dev/sdb5 after the next reboot of your server. This is why on a default RHEL 7 installation UUIDs are used instead of device names. Every file system by default has a UUID associated to it, not just file systems that are used to store files but also special file systems such as the swap file system. You can use the blkid command to get an overview of the current file systems on your system and the UUID that is used by that file system.

[root@rhel7 ~]# 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   --使用uuid挂载设备
Manually mounting devices using the UUID is not exactly easier. If mounts are automated as discussed in the next section, however, it does make sense using UUIDs instead of device names.

2. Automating File System Mounts Through /etc/fstab 

[root@rhel7 ~]# cat /etc/fstab 

#
# /etc/fstab
# Created by anaconda on Tue Jun ::
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(), findfs(), mount() and/or blkid() for more info
#
/dev/mapper/rhel-root / xfs defaults
UUID=2f8b9056--4bea-bb94-bc2f7f8de206 /boot xfs defaults
/dev/mapper/rhel-swap swap swap defaults #added by rusky:used for testing.
/dev/sdb1 /testdisk ext4 defaults

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

Notice that in the mount point not all file systems use a directory name. Some system devices such as swap are not mounted on a directory, but on a kernel interface. It is easy to recognize when a kernel interface is used; its name does not 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 are required, this line will just read “defaults.” To offer specific functionality, a large number of 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 that was 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 be checked while booting. Put a 0 if you do not want to check the file system at all, a 1 if this is the root file system which needs to be checked before anything else, and a 2 if this is a nonroot file system that needs to be checked while booting.

Mounting File Systems的更多相关文章

  1. Introducing Microsoft Sync Framework: Sync Services for File Systems

    https://msdn.microsoft.com/en-us/sync/bb887623 Introduction to Microsoft Sync Framework File Synchro ...

  2. centos重启报错Umounting file systems:umount:/opt:device is busy

    系统重启报错: Umounting file systems:umount:/opt:device is busy 只能硬关机,回想一下最近刚安装了nod32 for linux x64的杀毒软件,开 ...

  3. centos 7 系统启动不了 出现报错dependency failed for /mnt , dependency failed for local file systems

    阿里云一台Ecs重启后启动不了,出现报错 dependency failed for /mnt , dependency failed for local file systems ,  报错的原因  ...

  4. Log-structured File Systems

    换到博客园排版有问题,原版在这里:http://xubenbenhit.github.io/LogStructureFileSystem.html Log-structured File System ...

  5. 程序员的智囊库系列之3--分布式文件系统(Distributed file systems)

    程序员的智囊库系列之3--分布式文件系统(Distributed file systems) 这是程序员的智囊库系列的第三篇文章.上一篇文章本来打算介绍几个搭建网站的框架,但由于这部分的内容较多,还需 ...

  6. enable user-defined extended attributes for ext3 file systems; 增加ext3 文件系统的扩展属性;

    To enable user-defined extended attributes for ext3 file systems (i.e. device), use: tune2fs -o user ...

  7. “df: cannot read table of mounted file systems”.

    “df: cannot read table of mounted file systems”.“df -l” returned an error: “df: cannot read table of ...

  8. Understanding Manycore Scalability of File Systems

    多核场景下,不同文件系统,文件操作的性能评估.

  9. NFS(Network File System)服务配置和使用

    Sun公司开发NFS (Network File System)之初就是为了在不同linux/Unix系统之间共享文件或者文件夹.可以在本地通过网络挂载远程主机的共享文件,和远程主机交互.NFS共享存 ...

随机推荐

  1. Eclipse怎么忽略掉报错的js文件

    第一步,我们要先定位错误在哪里,选择菜单里window——show view——other,选择Problems. 第二步,点击有红叉的项目,在Problems视图中,可以看到是什么错,哪个文件夹中的 ...

  2. thinkphp对文件的上传,删除,下载操作

    工作需要,整理一下最近对php的学习经验,希望能对自己有帮助或者能帮助那些需要帮助的人. thinkphp对文件的操作,相对来说比较简单,因为tp封装好了一个上传类Upload.class.php 废 ...

  3. 你好,C++(38)从问题描述中发现对象的属性和行为 6.4 工资程序成长记:类与对象(上)

    6.4  工资程序成长记:类与对象 “夜半三更哟,盼天明:寒冬腊月哟,盼春风.若要盼得哟,涨工资,岭上……”自从上次老板许诺给小陈涨工资以后,一转眼又过去几个月了,可是涨工资的事一点动静都没有.小陈只 ...

  4. linux 进程数

    一.linux系统支持的最大进程数 限制1:既然系统使用pid_t表示进程号,那么最大进程数不能超过pid_t类型的最大值吧 限制2:使用命令ulimit -u查看系统中限制的最大进程数,我的机器上是 ...

  5. [置顶] css 背景透明,文字不透明,alpha滤镜,opacity,position:relative;

    都知道,在alpha滤镜下,背景透明了,里面的文字也会跟随透明,我们可以设置内容的position为relative可以解决这个问题 但是在position为absolute这么做却没有效果,怎么解决 ...

  6. 绘图时,根据size()和自定义rect编程的区别

    在绘图的时候,很多时候编写的代码需要根据当前窗口自身的size来进行绘制,这个时候可以添加一个额外的中间rect来做过度,这样以后的绘图机制不会 随着size的变化而不断变化.你的处理逻辑可以保持不变 ...

  7. 关于一个注册邮箱的demo

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/stri ...

  8. angularJS中如何写服务

    服务的用途 服务提供了一种能在应用的整个生命周期内保持数据的方法,它能够在控制器之间进行通信,并且能保证数据的一致性 服务提供了把特定功能相关联的方法集中在一起的接口 如何创建服务 angularJS ...

  9. js在html中的加载执行顺序

    1.加载顺序:引入标记<script />的出现顺序,依次加载 页面上的Javascript代码是HTML文档的一部分,所以Javascript在页面装载时执行的顺序就是其引入标记< ...

  10. [Python笔记]第四篇:内置函数

    本篇主要内容:内置函数 函数 参考:https://docs.python.org/3.5/library/functions.html 内置函数列表 一.数学运算类 abs(x)求绝对值 >& ...