Overlay file system linux

From Teknologisk videncenter
Revision as of 06:31, 20 September 2024 by Heth (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Single lower directory example

#/usr/bin/env bash
mkdir lower # Common fs 
mkdir upper1 work1 merged1   # Instance 1 fs
mkdir upper2 work2 merged2   # Instance 2 fs

# Populate
touch lower/lib1 lower/lib2 upper1/file1-1 upper1/file1-2 upper2/file2-1

mount -t overlay  overlay -o lowerdir=./lower,upperdir=./upper1,workdir=./work1 ./merged1
mount -t overlay  overlay -o lowerdir=./lower,upperdir=./upper2,workdir=./work2 ./merged2

Multiple lower directory example

#/usr/bin/env bash
mkdir lower # Common fs 
mkdir lower1-1 lower1-2 lower1-3
mkdir upper1 work1 merged1   # Instance 1 fs
mkdir upper2 work2 merged2   # Instance 2 fs

# Populate
touch lower/lib1 lower/lib2 lower1-1/lib1-1 lower1-2/lib1-2 lower1-3/lib1-3 upper1/file1-1 upper1/file1-2 upper2/file2-1

mount -t overlay  overlay -o lowerdir=./lower,upperdir=./upper1,workdir=./work1 ./merged1
mount -t overlay  overlay -o lowerdir=./lower,upperdir=./upper2,workdir=./work2 ./merged2

Links