-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add -o lbwrite (balance write to all rw disks judge by free space)
- Loading branch information
Showing
9 changed files
with
236 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/data/backup1=RW:/data/backup2=RW /data/backup unionfs rw,cow,max_files=32768,allow_other,use_ino,suid,dev,nonempty,lbwrite 0 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
#!/bin/bash | ||
|
||
label=$1 | ||
export PATH=/sbin:/usr/local/bin:/bin:/usr/bin | ||
src=$1 | ||
mpoint=$2 | ||
shift 3 | ||
dirs=${@##*,dirs=} | ||
dirs=${dirs/,/:} | ||
mount.fuse "unionfs#$dirs" "$mpoint" -o ${@%%,dirs=*} | ||
mount.fuse "unionfs#$src" "$mpoint" -o ${@%%,dirs=*} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
#!/bin/bash | ||
# this is a legacy version (will be removed in the future). please use test.py. | ||
|
||
set -v | ||
set -e | ||
|
||
rm -rf original union working-copy | ||
mkdir original union working-copy original/play-dir original/del-dir | ||
echo v1 > original/file | ||
echo v1 > original/play-with-me | ||
echo v1 > original/delete-me | ||
|
||
cleanup() { | ||
if [ -e "union" ]; then fusermount -u -q union; fi | ||
rm -rf union original working-copy | ||
} | ||
trap cleanup EXIT | ||
|
||
src/unionfs -d -o cow working-copy=rw:original=ro union >unionfs.log 2>&1 & | ||
|
||
sleep 1 | ||
|
||
[ "$(cat union/file)" = "v1" ] | ||
|
||
echo "v2" > union/file | ||
[ "$(cat union/file)" = "v2" ] | ||
|
||
echo "v2" > union/play-with-me | ||
[ "$(cat union/play-with-me)" = "v2" ] | ||
|
||
[ -f union/play-with-me ] | ||
rm union/play-with-me | ||
[ ! -f union/play-with-me ] | ||
|
||
[ -f union/delete-me ] | ||
rm union/delete-me | ||
[ ! -f union/delete-me ] | ||
|
||
[ "$(ls union/play-dir)" = "" ] | ||
echo "fool" > union/play-dir/foo | ||
[ "$(ls union/play-dir)" = "foo" ] | ||
rm union/play-dir/foo | ||
[ "$(ls union/play-dir)" = "" ] | ||
|
||
[ -d union/play-dir ] | ||
rmdir union/play-dir | ||
[ ! -d union/play-dir ] | ||
|
||
[ -d union/del-dir ] | ||
rmdir union/del-dir | ||
[ ! -d union/del-dir ] | ||
|
||
! echo v1 > union/del-dir/foo | ||
|
||
[ ! -d union/del-dir ] | ||
mkdir union/del-dir | ||
[ ! -f union/del-dir/foo ] | ||
echo v1 > union/del-dir/foo | ||
[ -f union/del-dir/foo ] | ||
rm union/del-dir/foo | ||
[ -d union/del-dir ] | ||
rmdir union/del-dir | ||
[ ! -d union/del-dir ] | ||
|
||
# rmdir() test | ||
set +e | ||
set +v | ||
rc=0 | ||
mkdir original/testdir | ||
touch original/testdir/testfile | ||
mkdir working-copy/testdir | ||
rmdir union/testdir 2>/dev/null | ||
if [ $? -eq 0 ]; then | ||
echo "rmdir succeeded, although it must not" | ||
rc=$(($rc + $?)) | ||
fi | ||
rm union/testdir/testfile | ||
rc=$(($rc + $?)) | ||
rmdir union/testdir/ | ||
rc=$(($rc + $?)) | ||
if [ $rc -ne 0 ]; then | ||
echo "rmdir test failed" | ||
exit 1 | ||
else | ||
echo "rmdir test passed" | ||
fi | ||
set -e | ||
|
||
fusermount -u union | ||
|
||
[ "$(cat original/file)" = "v1" ] | ||
[ "$(cat original/play-with-me)" = "v1" ] | ||
[ "$(cat original/delete-me)" = "v1" ] | ||
[ -d original/play-dir ] | ||
[ -d original/del-dir ] | ||
[ "$(cat working-copy/file)" = "v2" ] | ||
|
||
echo "ALL TEST PASSED" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters