mount command

mount 用于挂载Linux系统外的文件。

挂载:linux将一个设备(通常是指存储设备)挂接到一个已经存在的目录上。

注意:

  1. 这个目录可以不为空,但挂载后这个目录以前的内容将不可用。umount之后可以恢复正常
  2. 挂载点必须是一个已经存在的目录。

linux 操作系统将所有的设备都视为文件。我们想要访问存储设备中的文件,必须将文件所在的分区挂载到一个已经存在的目录上,然后通过访问这个目录来访问存储设备。

挂载命令mount

格式 mount [参数][设备名称][挂载点]

注意:mount命令只能在root权限下运行 参数 -t: 指定要挂载的设备上的文件系统类型; -r: readonly, 只读挂载; -w: read and write, 读写挂载; -n: 不更新/etc/mtab; -a: 自动挂载所有支持自动挂载的设备

常用参数 mount -t type -o options device dir device 要挂载的设备(必填)。有些文件系统不需要指定具体的设备,可以随便填一个字符串 dir 挂载到哪个目录(必填) type 要挂载的设备上的文件系统类型(可选) options 挂载参数(可选)

查看挂载情况

查看内核追踪到的已挂载的所有设备:cat /proc/mounts 格式 mount [参数][设备名称][挂载点]

参考文献
Linux挂载详解
Linux mount(segmentfault-blog)
man-pages

df

SYNOPSIS df - report file system disk space usage

参考文献
Linux man-pages

Descriptions This manual page documents the GNU version of df. df displays the amount of disk space available on the file system containing each file name argument. If no file name is given, the space available on all currently mounted file systems is shown. Disk space is shown in 1K blocks by default, unless the environment variable POSIXLY_CORRECT is set, in which case 512-byte blocks are used.

   If an argument is the absolute file name of a disk device node
   containing a mounted file system, df shows the space available on
   that file system rather than on the file system containing the device
   node.  This version of df cannot show the space available on
   unmounted file systems, because on most kinds of systems doing so
   requires very nonportable intimate knowledge

OPTIONS