Ubuntu Pastebin

Paste from jdstrand at Thu, 3 Nov 2016 11:59:28 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
$ cat overlay-dir
#!/bin/sh
set -e

if [ -z "$1" ]; then
    echo "`basename $0` <dir>"
    exit 1
fi
dir="$1"

if [ ! -d "$dir" ]; then
    echo "'$dir' is not a directory"
    exit 1
fi

tmp=`mktemp -d`
overlay="$tmp/overlay"
work="$tmp/work"
mkdir "$overlay" "$work"

# This does not handle directories with spaces in the names
cmd="sudo mount -t overlayfs -o lowerdir=$dir,upperdir=$overlay,workdir=$work overlayfs $dir"
echo "$cmd"
$cmd

echo "You may now write to '$dir'"



Example usage:
$ /path/to/overlay-dir <dir>
$ cp ./foo <dir>/foo
Download as text