centos 7 挂载磁盘

1. 临时挂载

其中/dev/sdb1 是格式化好的磁盘,/data是待挂载的目录,要求必需存在 

mount /dev/sdb1   /data

2. 永久挂载,即开机就挂载上

vi /etc/fstab

最下面增加1行

/dev/sdb1                /data                   xfs     defaults        0   0

保存即可

 

解释

其中/dev/sdb1是格式化好的磁盘

/data 是待挂载的目录

xfs是   磁盘的文件格式,也可以是efs,  ext2, ext3, hfs等类型 

defaults 是挂载点和文件系统的关系

其中的关系有

defaults
     use default options: rw, suid, dev, exec, auto, nouser, and async.

noauto

    do not mount when "mount -a" is given (e.g., at boot time)

user

    allow a user to mount

owner

     allow device owner to mount

comment
     or x-<name> for use by fstab-maintaining programs

nofail

     do not report errors for this device if it does not exist.

如果不会选择的话就用defaults

第1 个0 

   表示文件系统是否需要dump(要参考一下dump命令) 0表示不需要dump

   This field is used for these filesystems by the dump(8) command to determine which filesystems need to be dumped. If the fifth field is not present, a value of zero is returned and dump will assume that the filesystem does not need to be dumped.

第2个0

    用来设置开机后硬盘的检查顺序。0表示不检查。(参考 fsck命令)

    This field is used by the fsck(8) program to determine the order in which filesystem checks are done at reboot time. The

root filesystem should be specified with a fs_passno of 1, and other filesystems should have a fs_passno of 2. Filesystems
within a drive will be checked sequentially, but filesystems on different drives will be checked at the same time to utilize
parallelism available in the hardware. If the sixth field is not present or zero, a value of zero is returned and fsck will
assume that the filesystem does not need to be checked.

 

上一篇:nfs服务器搭建


下一篇:【协作式原创】Linux基础(CentOS7.7)