mount 命令

来源:互联网 发布:日本爱知大学图片 编辑:程序博客网 时间:2024/04/29 12:33

在linux下 通过mount 命令将格式化好的磁盘进行挂载!  

such as  mount /dev/sda2(要挂载的分区)  /mnt(挂载点)


常用参数

不带参数的mount 会显示目前所有的已挂载的文件系统

-t 制定文件的类型

-o制定挂载项 

         ro, rw 只读或者只写操作

         remount  重新挂载

         atime 表示每次访问文件更新文件访问时间

         noatime 表示每次访问文件不更新文件访问时间

         sync 表示直接写入磁盘

         async 表示使用缓存, 不直接写入磁盘, 默认是使用async


使用umount 进行卸载

如果正在使用 挂载文件系统那么 umount回提示 不能卸载

这时候可以用fuser -m /dev/sda2 来看一下哪个进程正在使用挂载文件

或者losf  /mnt(挂载点)  来看一下  挂载点正在被谁使用着那


开机时候自己挂载某些文件系统通过/etc/fstab  

fstab 在维基上的解释就是

The fstab (/etc/fstab) (or file systems table) file is a system configuration file commonly found on Unix systems. On Linux, it is part of the util-linux package. The fstab file typically lists all available disks and disk partitions, and indicates how they are to be initialized or otherwise integrated into the overall system's file system. fstab is still used for basic system configuration, notably of a system's main hard drive and startup file system, but for other uses has been superseded in recent years by automatic mounting.


最后一句表明了 他一直用来自动挂载;fstab的每一列代表一个挂载配置格式如下:

需要挂载的设备    挂载点      文件系统     挂载选项    (dump, fsck相关选项)

/dev/sda2             /mnt          ext4           noatime         0  0

0 0