问题描述
根据文档,应该可以使用多个较低层与overlayfs,但我不能让它在内核3.18.13工作。我使用它错了,还是我需要一个后来的内核,如果是的话,哪一个?
这工作:
>>> mkdir lower1 lower2 upper workdir merged
>>> echo hello> lower1 / myfile
>>> sudo mount -t overlay覆盖-olowerdir = lower1,upperdir = upper,workdir = workdir / merged
>>> cat merged / myfile
hello
例子非常类似于文件:
>>>>>>>>>> mount>>>>>> $ b丢失代码页或帮助程序,或其他错误
在某些情况下,可以在syslog中找到有用的信息 - 试试
dmesg |尾巴左右。
>>> dmesg | tail -n1
[42131.327203] overlayfs:缺少upperdir或lowerdir或workdir
ok,let添加它们:
$ b
>>> sudo mount -t overlay overlay -olowerdir = lower1:lower2,upperdir = upper, workdir = workdir / merged
mount:错误的fs类型,错误的选项,覆盖错误的超级块,
缺少代码页或帮助程序或其他错误
在某些情况下,有用的信息是在syslog中找到 - 试试
dmesg |尾巴左右。
>>> dmesg | tail -n1
[42155.052961] overlayfs:未能解析'lower1:lower2':-2
使用多个overlayfs挂载实现多个下层目录的堆栈可能是很诱人的,但是这已经被证明是不可实现的。我看到 ,但是现在还不清楚为什么这个值现在设置为2。
因此,如果你用3.18卡住,还不能移动到3.19(如 toto38
建议),那么你正在寻找一种方法来使用多个低目录而不重新编译你的内核?如果你使用的是RHEL / CentOS / Fedora,那么funionfs可能是你最好的选择( yum install funionfs
)。您可以在单个装入命令中指定多个只读较低的目录:
funionfs -o dirs =< FIRST_LOWER_RO_DIR_PATH> = RO:< SECOND_LOWER_RO_DIR_PATH> = RO:其中UPPER_RW_DIR_PATH> NONE< MOUNT_POINT_DIR_PATH>
我从来没有比较overlayfs和funionfs的性能,不过overlayfs在内核空间中工作,funionfs在用户空间(通过保险丝),所以我认为funionfs可能比overlayfs多一点的开销。
According this document it should be possible to use multiple lower layers with overlayfs, but I can't get it to work on kernel 3.18.13. Am I using it wrong, or do I need a later kernel, and if so which one?
this works:
>>>mkdir lower1 lower2 upper workdir merged
>>>echo hello > lower1/myfile
>>>sudo mount -t overlay overlay -olowerdir=lower1,upperdir=upper,workdir=workdir/ merged
>>>cat merged/myfile
hello
example very similar to document:
>>>sudo mount -t overlay overlay -olowerdir=lower1:lower2 merged
mount: wrong fs type, bad option, bad superblock on overlay,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so.
>>>dmesg | tail -n1
[42131.327203] overlayfs: missing upperdir or lowerdir or workdir
ok, lets add them:
>>>sudo mount -t overlay overlay -olowerdir=lower1:lower2,upperdir=upper,workdir=workdir/ merged
mount: wrong fs type, bad option, bad superblock on overlay,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so.
>>>dmesg | tail -n1
[42155.052961] overlayfs: failed to resolve 'lower1:lower2': -2
It may be tempting to use multiple overlayfs mounts to achieve "stacking" of multiple lower directories, however, this has proven not achievable beyond two mounts with later kernel versions. That is, if you mount one set of upper/lower directories to a mountpoint then use the same mountpoint as another overlayfs mount's lower directory, the third mount attempt would fail and you would see this in dmesg: "overlayfs: maximum fs stacking depth exceeded". I see why a limiting stacking depth is needed, but it is unclear to me why this is currently set to 2.
So if you are stuck with 3.18 and can't yet move to 3.19 (as toto38
suggests) then you are looking for a way to use multiple "lower" directories without recompiling your kernel? If you're using RHEL/Centos/Fedora then funionfs is probably your best bet (yum install funionfs
). You can specify multiple read-only lower directories in a single mount command:
funionfs -o dirs=<FIRST_LOWER_RO_DIR_PATH>=RO:<SECOND_LOWER_RO_DIR_PATH>=RO:<UPPER_RW_DIR_PATH> NONE <MOUNT_POINT_DIR_PATH>
I've never compared the performance between overlayfs and funionfs, though overlayfs is working in kernel space and funionfs is in userspace (via fuse) so I'd suppose that funionfs is probably has a bit more overhead than overlayfs.
这篇关于如何在overlayfs中使用多个较低层的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!