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

查看:207
本文介绍了如何提供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 {} \;

我该如何提供两层以上?

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:

  • #define FILESYSTEM_MAX_STACK_DEPTH
  • stacking depth check

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

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天全站免登陆