说明
FUSE 是Linux Kernel的特性之一:一个用户态文件系统框架,a userspace filesystem framework。 形象的说就是可以在用户态运行一个程序,这个程序暴露出一个FUSE文件系统,对这个文件系统进行的读写操作都会被转给用户态的程序处理。
FUSE由内核模块 fuse.ko 和用户空间的动态链接库 libfuse.* 组成,如果要开发使用fuse的用户态程序,需要安装 fuse-devel :
yum install fuse-devel
资料
Kernel中有两份关于FUSE的文档:
内核文档写的都超级简单,可以结合使用fuse的例子来学习fuse的使用: lxc/lxcfs 。
Fuse control filesystem
加载fuse.ko后,可以用下面的命令加载fusectl fs:
mount -t fusectl none /sys/fs/fuse/connections
每个使用fuse的进程有一个对应的目录:
$ ls /sys/fs/fuse/connections
38 42
直接挂载 fuse filesystem 文件系统
kernel/Documentation/filesystems/fuse.txt 中说fuse提供了 fuse 和 fuseblk 两种文件系统类型,可以作为mount命令的 -t 参数的参数值。
没搞清楚要怎样用mount直接挂载fuse文件系统,这里先收录文档给出的挂载选项,具体挂载方法弄明白以后再补充(2019-01-21 19:12:47):
'fd=N'
The file descriptor to use for communication between the userspace
filesystem and the kernel. The file descriptor must have been
obtained by opening the FUSE device ('/dev/fuse').
'rootmode=M'
The file mode of the filesystem's root in octal representation.
'user_id=N'
The numeric user id of the mount owner.
'group_id=N'
The numeric group id of the mount owner.
'default_permissions'
By default FUSE doesn't check file access permissions, the
filesystem is free to implement its access policy or leave it to
the underlying file access mechanism (e.g. in case of network
filesystems). This option enables permission checking, restricting
access based on file mode. It is usually useful together with the
'allow_other' mount option.
'allow_other'
This option overrides the security measure restricting file access
to the user mounting the filesystem. This option is by default only
allowed to root, but this restriction can be removed with a
(userspace) configuration option.
'max_read=N'
With this option the maximum size of read operations can be set.
The default is infinite. Note that the size of read requests is</