如何提供overlayfs的嵌套挂载 [英] How provide nested mount of overlayfs

查看:31
本文介绍了如何提供overlayfs的嵌套挂载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将overlayfs的层挂载为下一层overlayfs,但是在两层之后它就崩溃了

I try mount layer of overlayfs as lower layer next overlayfs, but after two layer it's crash

mount -t overlayfs -o rw,lowerdir=/tmp/test/layers/centos5.6-layer0-lower,upperdir=/tmp/test/layers/centos5.6-layer0-upper overlayfs /tmp/mount/centos5.6-layer0-mount
# remove deleted files into overlayfs
find /tmp/mount/centos5.6-layer0-mount -lname '(overlay-whiteout)' -exec rm -rf {} ;

mount -t overlayfs -o rw,lowerdir=/tmp/mount/centos5.6-layer0-mount,upperdir=/tmp/test/layers/centos5.6-layer1-upper overlayfs /tmp/mount/centos5.6-layer1-mount
# remove deleted files into overlayfs
find /tmp/mount/centos5.6-layer1-mount -lname '(overlay-whiteout)' -exec rm -rf {} ;

mount -t overlayfs -o rw,lowerdir=/tmp/mount/centos5.6-layer1-mount,upperdir=/tmp/test/layers/centos5.6-layer2-upper overlayfs /tmp/mount/centos5.6-layer2-mount
mount: wrong fs type, bad option, bad superblock on overlayfs,
       missing codepage or helper program, or other error
       (for several filesystems (e.g. nfs, cifs) you might
       need a /sbin/mount.<type> helper program)
       In some cases useful info is found in syslog - try
       dmesg | tail  or so
# remove deleted files into overlayfs
find /tmp/mount/centos5.6-layer2-mount -lname '(overlay-whiteout)' -exec rm -rf {} ;

mount -t overlayfs -o rw,lowerdir=/tmp/mount/centos5.6-layer2-mount,upperdir=/tmp/test/layers/centos5.6-layer3-upper overlayfs /tmp/mount/centos5.6-layer3-mount
find /tmp/mount/centos5.6-layer3-mount -lname '(overlay-whiteout)' -exec rm -rf {} ;

我怎样才能提供超过 2 层?

How can I provide more then 2 layer?

推荐答案

如果你检查 dmesg 输出,你会看到内核声明试图超过最大堆叠深度:

If you check dmesg output, you will see the kernel stating an attempt to exceed the max stacking depth:

overlayfs: maximum fs stacking depth exceeded

确实,堆叠深度限制为2,见overlayfs dev分支:

Indeed, the stacking depth is limited to 2, see the overlayfs dev branch:

如果您想超越这个深度,您可以尝试更改常量并构建自己的内核.但是,请记住溢出堆栈的风险(根据评论).

If you want to go beyond this depth, you could try changing the constant and building your own kernel. However, bear in mind the risk of overflowing the stack (per the comments).

这篇关于如何提供overlayfs的嵌套挂载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆