命令介绍mount命令用于挂载设备或文件系统。语法格式mount[option]device|dir选项说明-V#显示版本信息-h#显示帮助信息-v#通常和-f用于调试-a#挂载/etc/fstab中定义的所有文件系统-F#该命令通常与-a一起使用,它会为每个挂载动作生成一个行程,负责在系统需要挂载大量NFS文件系统时执行可以加速挂载的动作-f#用于日常排错-s-r#功能同-oro-w#功能同-orw-L#将硬盘分割成特定的标签并挂起-t#指定文件系统的类型-oasync#开启异步模式-osync#以同步模式执行-oauto,-onoauto#开启/关闭自动模式-oro#使用只读模式挂载-orw#使用读写模式挂载应用示例mount/dev/hda1tothe/mntdirectory[root@centos7~]#mount/dev/hda1/mntmount/dev/hda1inread-onlymodetothe/mntdirectory[root@centos7~]#mount-oro/dev/hda1/mnt列出所有当前挂载的文件系统[root@centos7~]#mountsysfson/systypesysfs(rw,nosuid,nodev,noexec,relatime)procon/proctypeproc(rw,nosuid,nodev,noexec,relatime)devtmpfson/devtypedevtmpfs(rw,nosuid,size=486068k,nr_inodes=121517,mode=755)securityfson/sys/kernel/securitytypesecurityfs(rw,nosuid,nodev,noexec,relatime)tmpfson/dev/shmtypetmpfs(rw,nosuid,nodev)devptson/dev/ptstypedevpts(rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)tmpfson/run泰petmpfs(rw,nosuid,nodev,mode=755)tmpfson/sys/fs/cgrouptypetmpfs(ro,nosuid,nodev,noexec,mode=755)cgroupon/sys/fs/cgroup/systemdtypecgroup(rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)pstoreon/sys/fs/pstoretypepstore(rw,nosuid,nodev,noexec,relatime)cgroupon/sys/fs/cgroup/perf_eventtypecgroup(rw,nosuid,nodev,noexec,relatime,perf_event)cgroupon/sys/fs/cgroup/hugetlbtypecgroup(rw,nosuid,nodev,noexec,relatime,hugetlb)cgroupon/sys/fs/cgroup/blkiotypecgroup(rw,nosuid,nodev,noexec,relatime,blkio)cgroupon/sys/fs/cgroup/cpusettypecgroup(rw,nosuid,nodev,noexec,relatime,cpuset)cgroupon/sys/fs/cgroup/devicestypecgroup(rw,nosuid,nodev,noexec,relatime,devices)cgroupon/sys/fs/cgroup/net_cls,net_priotypecgroup(rw,nosuid,nodev,noexec,relatime,net_prio,net_cls)cgroupon/sys/fs/cgroup/cpu,cpuaccttypecgroup(rw,nosuid,nodev,noexec,relatime,cpuacct,cpu)cgroupon/sys/fs/cgroup/pidstypecgroup(rw,nosuid,nodev,noexec,relatime,pids)cgroupon/sys/fs/cgroup/memorytypecgroup(rw,nosuid,nodev,noexec,relatime,memory)cgroupon/sys/fs/cgroup/freezertypecgroup(rw,nosuid,nodev,noexec,relatime,freezer)configfson/sys/kernel/configtypeconfigfs(rw,relatime)/dev/mapper/centos-rooton/typexfs(rw,relatime,attr2,inode64,noquota)systemd-1在/proc/sys/fs/binfmt_misc上键入autofs(rw,relatime,fd=32,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=13688)debugfson/sys/kernel/debugtypedebugfs(rw,relatime)hugetlbfson/dev/hugepagestypehugetlbfs(rw,relatime)mqueueon/dev/mqueuetypemqueue(rw,relatime)/dev/sda1on/boottypexfs(rw,relatime,attr2,inode64,noquota)tmpfson/run/user/0typetmpfs(rw,nosuid,nodev,relatime,size=99572k,mode=700)查找指定文件类型的挂下载信息[root@centos7~]#mount-l-ttmpfstmpfson/dev/shmtypetmpfs(rw,nosuid,nodev)tmpfson/runtypetmpfs(rw,nosuid,nodev,mode=755)tmpfson/sys/fs/cgrouptypetmpfs(ro,nosuid,nodev,noexec,mode=755)tmpfson/run/user/0typetmpfs(rw,nosuid,nodev,relatime,size=99572k,mode=700)[root@centos7~]#mount-l-txfs/dev/mapper/centos-rooton/typexfs(rw,relatime,attr2,inode64,noquota)/dev/sda1on/boottypexfs(rw,relatime,attr2,inode64,noquota)[root@centos7~]#mount-l-tdevptsdevptson/dev/ptstypedevpts(rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)命令介绍umount命令用于uninstall已经挂载的文件系统请注意,文件系统在繁忙时无法卸载,例如当文件系统上有打开的文件时,进程的工作目录在其中,或者正在使用交换文件。语法格式umount-a[-d??flnrv][-tvfstype][-Ooptions]选项说明-a#卸载/etc/mtab中记录的所有文件系统-h#显示帮助-n#不要将信息存储在unmount中/etc/mtabfile-r#如果无法卸载成功,尝试以只读方式重新挂载文件系统-t<文件系统类型>#卸载指定文件系统-v#执行时显示详细信息-V#显示版本信息应用示例#按设备名卸载[root@centos7~]#umount-v/dev/sda1/dev/sda1umounted#按挂载点卸载[root@centos7~]#umount-v/opt/dev_mount//iso/system-1.0.0.isoumounted未挂载的文件系统(运行文件系统)[root@centos7~]#umount-v/opt/dev_mount/umount:/opt/dev_mount/:deviceisbusy[root@centos7~]#lsof|grepdev_mount#查找打开的文件bash4147francoiscwdDIR5,110243/opt/dev_mount/
