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.