码迷,mamicode.com
首页 > 其他好文 > 详细

[文件系统]文件系统学习笔记(五)---mount系统调用(1)

时间:2014-11-01 23:07:15      阅读:299      评论:0      收藏:0      [点我收藏+]

标签:blog   http   io   os   ar   for   sp   strong   文件   

1,mount命令各个参数的含义

mount命令各个参数含义

 

2,mount系统调用中flag参数的含义
#define MS_RDONLY 1  /* Mount read-only */
#define MS_NOSUID 2  /* Ignore suid and sgid bits */
#define MS_NODEV  4  /* 在已经安装文件系统上禁止访问设备文件 */
#define MS_NOEXEC 8  /* 在已经安装文件系统上不允许程序运行 */
#define MS_SYNCHRONOUS   16  /* Writes are synced at once */
#define MS_REMOUNT   32  /* Alter flags of a mounted FS */
/* 允许强制枷锁 */
#define MS_MANDLOCK  64  /* 不允许强制加锁 */
#define MS_DIRSYNC   128 /* 目录上写操作是即时的 */
#define MS_NOATIME   1024   /* 不更新文件访问时间. */
#define MS_NODIRATIME 2048/* Do not update directory access times */
/* 创建一个“绑定挂载”,这就使得一个文件或目录在系统目录树的另外一个点上可以看得见 */
#define MS_BIND      4096
/* 把一个已挂载文件系统移动到另一个挂载点,相当于先执行卸载,然后将文件系统挂载在另外的一个目录下 */
#define MS_MOVE      8192
#define MS_REC       16384 /* 为目录子树递归的创建绑定挂载 */
#define MS_SILENT 32768
#define MS_POSIXACL  (1<<16)    /* VFS does not apply the umask */
#define MS_UNBINDABLE    (1<<17)    /* change to unbindable */
#define MS_PRIVATE   (1<<18)    /* change to private */
#define MS_SLAVE  (1<<19)    /* change to slave */
#define MS_SHARED (1<<20)    /* change to shared */
#define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */
#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
#define MS_I_VERSION (1<<23) /* Update inode I_version field */
#define MS_STRICTATIME   (1<<24) /* Always perform atime updates */
#define MS_ACTIVE (1<<30)
#define MS_NOUSER (1<<31)


绑定挂载(MS_BIND)使得一个文件或目录在系统目录树的另外一个点上可以看得见,而对原目录的操作将实际上应用于绑定的目录,而并不改变原目录。如,
mount --bind /vz/apt/ /var/cache/apt/archives/
上面命令的意思是把 /vz/apt/ 目录绑定挂载到 /var/cache/apt/archives/,以后只要是写到 /var/cache/apt/archives/ 目录中的数据,都会自动写到其绑定目录 /vz/apt/ 中,
真正的 /var/cache/apt/archives/ 中并没有数据。 
环回挂载(loopback mount),环回文件系统系统依存於一个储存在别的文件系统系统中的文件,并将这个文件当作是一个外围设备来操作。这个虚拟的设备如同真实设备一样, 可以被格式化或挂载於目录树中。环回文件系统的设备文件通常是 /dev/loop0 或是 /dev/loop1 等等, 这些设备再被指向所依存的文件,如此这个档案便能被视为虚拟设备而被挂载。比如:mount initrd.img /root/initrd -t ext2 -o loop  递归地环回挂载,递归地环回挂载就是将原来目录树中的挂载,同样地都完全地搬到新的目录下

[文件系统]文件系统学习笔记(五)---mount系统调用(1)

标签:blog   http   io   os   ar   for   sp   strong   文件   

原文地址:http://www.cnblogs.com/zhiliao112/p/4067840.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!