Overlayfs: Difference between revisions
From wikinotes
(→Usage) |
|||
(One intermediate revision by the same user not shown) | |||
Line 49: | Line 49: | ||
</source> | </source> | ||
</blockquote><!-- ReadOnly Mounts --> | </blockquote><!-- ReadOnly Mounts --> | ||
== Identifying Source Layers == | |||
<blockquote> | |||
I haven't tried it yet, but the <code>nfs_export</code> mount option looks very promising. | |||
</blockquote><!-- Identifying Source Layers --> | |||
</blockquote><!-- Usage --> | </blockquote><!-- Usage --> | ||
= Troubleshooting = | |||
<blockquote> | |||
== mount(2) system call failed: Stale file handle == | |||
<blockquote> | |||
disabling index and metacopy seems to work. | |||
<syntaxhighlight lang="bash"> | |||
mount -t overlay overlay \ | |||
-o index=off \ | |||
-o metacopy=off \ | |||
-o lowerdir=/lower3:/lower2:/lower1,upperdir=/upper,workdir=/work \ | |||
/merged | |||
</syntaxhighlight> | |||
</blockquote><!-- --> | |||
</blockquote><!-- Troubleshooting --> |
Latest revision as of 03:38, 18 November 2021
overlayfs is a fuse filesystem that allows you to merge multiple directories into one filesystem.
overlayfs mounts can be stacked together.
Documentation
official docs https://www.kernel.org/doc/html/latest/filesystems/overlayfs.html
Usage
Writable Mounts
The basic idea is that you combine one or more lower layers with a higher layer.
If a file exists in both layers, the higher layer's file is used.# mount a single lower dir with a higher dir mount -t overlay overlay \ -o lowerdir=/lower,upperdir=/upper,workdir=/work \ /merged # mount multiple lower dirs with a higher dir (separated by ':') # Directories stacked !!RIGHT TO LEFT!! mount -t overlay overlay \ -o lowerdir=/lower3:/lower2:/lower1,upperdir=/upper,workdir=/work \ /mergedReadOnly Mounts
If dirs are read-only, you don't need to care about lower/upper layer semantics.
Mounts are read-only automatically ifupperdir
is not specified.NOTE:
mounts are mounted in order RIGHT TO LEFT.
Files in below lower1 are loaded first, and overlaid by lower3mount -t overlay overlay \ -o lowerdir=/lower3:/lower2:/lower1 /mergedIdentifying Source Layers
I haven't tried it yet, but the
nfs_export
mount option looks very promising.
Troubleshooting
mount(2) system call failed: Stale file handle
disabling index and metacopy seems to work.
mount -t overlay overlay \ -o index=off \ -o metacopy=off \ -o lowerdir=/lower3:/lower2:/lower1,upperdir=/upper,workdir=/work \ /merged