Added scripts.
This commit is contained in:
parent
3d18da08ae
commit
f2333fdfe7
.gitmodules
bin
copy-all-and-measure
copy-snapshot
create-and-measurecreate-test-setup
destroy-targetdestroy-testdisplay-usagereorganize-encrypted-nestedzfs-diff-moveexternal
passphrase
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
[submodule "external/zfs-diff-move"]
|
||||
path = external/zfs-diff-move
|
||||
url = https://git.aweirdimagination.net/perelman/zfs-diff-move.git
|
30
bin/copy-all-and-measure
Executable file
30
bin/copy-all-and-measure
Executable file
|
@ -0,0 +1,30 @@
|
|||
#!/bin/bash
|
||||
|
||||
./destroy-target
|
||||
|
||||
# TODO Create all sub-datasets
|
||||
zfs create tank/target
|
||||
#zfs create tank/target/large
|
||||
#zfs create tank/target/small
|
||||
#zfs create -o mountpoint=none tank/target/a
|
||||
#zfs create -o mountpoint=none tank/target/a/b
|
||||
#zfs create -o mountpoint=none tank/target/a/b/c
|
||||
#zfs create -o mountpoint=/tank/target/a/b/c/.d tank/target/a/b/c/.d
|
||||
|
||||
cat "$1"
|
||||
prev_snapshot=""
|
||||
for test_snapshot in $(zfs list -H -t snapshot -o name tank/test)
|
||||
do
|
||||
name="$(echo "$test_snapshot" | cut -d '@' -f 2)"
|
||||
echo "Processing snapshot: $name"
|
||||
#zfs diff "$prev_snapshot" "$test_snapshot"
|
||||
echo Running "$1" "$name" "$prev_snapshot"
|
||||
"$1" "$name" "$prev_snapshot"
|
||||
|
||||
echo zfs snapshot -r "tank/target@$name"
|
||||
zfs snapshot -r "tank/target@$name"
|
||||
|
||||
prev_snapshot="$name"
|
||||
done
|
||||
|
||||
./display-usage
|
3
bin/copy-snapshot/rsync-ahvx
Executable file
3
bin/copy-snapshot/rsync-ahvx
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
echo rsync -avhx -@-1 --delete --progress "/tank/test/.zfs/snapshot/$1/" "/tank/target/"
|
||||
rsync -avhx -@-1 --delete --progress "/tank/test/.zfs/snapshot/$1/" "/tank/target/"
|
3
bin/copy-snapshot/rsync-inplace
Executable file
3
bin/copy-snapshot/rsync-inplace
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
echo rsync -avhx -@-1 --delete --inplace --progress "/tank/test/.zfs/snapshot/$1/" "/tank/target/"
|
||||
rsync -avhx -@-1 --delete --inplace --progress "/tank/test/.zfs/snapshot/$1/" "/tank/target/"
|
3
bin/copy-snapshot/rsync-inplace-no-whole-file
Executable file
3
bin/copy-snapshot/rsync-inplace-no-whole-file
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
echo rsync -avhx -@-1 --delete --inplace --no-whole-file --progress "/tank/test/.zfs/snapshot/$1/" "/tank/target/"
|
||||
rsync -avhx -@-1 --delete --inplace --no-whole-file --progress "/tank/test/.zfs/snapshot/$1/" "/tank/target/"
|
3
bin/copy-snapshot/rsync-no-whole-file
Executable file
3
bin/copy-snapshot/rsync-no-whole-file
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
echo rsync -avhx -@-1 --delete --no-whole-file --progress "/tank/test/.zfs/snapshot/$1/" "/tank/target/"
|
||||
rsync -avhx -@-1 --delete --no-whole-file --progress "/tank/test/.zfs/snapshot/$1/" "/tank/target/"
|
5
bin/copy-snapshot/zfs-diff-move-then-rsync
Executable file
5
bin/copy-snapshot/zfs-diff-move-then-rsync
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
echo zfs-diff-move /tank/target /tank/test "tank/test@$2" "@$1"
|
||||
./zfs-diff-move /tank/target /tank/test "tank/test@$2" "@$1"
|
||||
echo rsync -avhx -@-1 --delete --inplace --no-whole-file --progress "/tank/test/.zfs/snapshot/$1/" "/tank/target/"
|
||||
rsync -avhx -@-1 --delete --inplace --no-whole-file --progress "/tank/test/.zfs/snapshot/$1/" "/tank/target/"
|
11
bin/create-and-measure
Executable file
11
bin/create-and-measure
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
./destroy-test
|
||||
zfs create -o compression=lz4 tank/test
|
||||
SCRIPT_DIR="$(pwd)"
|
||||
pushd /tank/test
|
||||
cat "$SCRIPT_DIR/$1"
|
||||
time "$SCRIPT_DIR/$1"
|
||||
popd
|
||||
zfs snapshot tank/test@final
|
||||
./display-usage
|
5
bin/create-test-setup/edit-part-of-file
Executable file
5
bin/create-test-setup/edit-part-of-file
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
dd if=/dev/urandom of=random-1M bs=1M count=1
|
||||
zfs snap tank/test@first
|
||||
sleep 0.001 # sleep long enough to ensure mtime is different
|
||||
dd if=/dev/urandom of=random-1M bs=1k count=1 conv=notrunc
|
2
bin/create-test-setup/empty
Executable file
2
bin/create-test-setup/empty
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
# Do nothing
|
26
bin/create-test-setup/encrypted-nested
Executable file
26
bin/create-test-setup/encrypted-nested
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/bin/sh
|
||||
|
||||
zfs create -o encryption=on -o keyformat=passphrase -o keylocation=file:///root/zfs-test/passphrase tank/test/encrypted
|
||||
mkdir /tank/test/encrypted/should-be-root
|
||||
mkdir -p /tank/test/encrypted/own-dataset/nested/more
|
||||
|
||||
for ver in a b c d
|
||||
do
|
||||
echo "$ver" > /tank/test/encrypted/ver
|
||||
echo "$ver" > /tank/test/encrypted/should-be-root/ver
|
||||
echo "$ver" > /tank/test/encrypted/own-dataset/ver
|
||||
echo "$ver" > /tank/test/encrypted/own-dataset/nested/ver
|
||||
echo "$ver" > /tank/test/encrypted/own-dataset/nested/more/ver
|
||||
zfs snapshot "tank/test/encrypted@$ver"
|
||||
done
|
||||
|
||||
zfs create -o encryption=on -o keyformat=passphrase -o keylocation=file:///root/zfs-test/passphrase tank/test/encrypted-new
|
||||
zfs create -p tank/test/encrypted-new/own-dataset/nested/more
|
||||
|
||||
for ver in a b c d
|
||||
do
|
||||
echo rsync -@-1 -avhx --progress --exclude=/should-be-root "/tank/test/encrypted/.zfs/snapshot/$ver/" /tank/test/encrypted-new/
|
||||
rsync -@-1 -avhx --progress --exclude=/should-be-root "/tank/test/encrypted/.zfs/snapshot/$ver/" /tank/test/encrypted-new/
|
||||
echo zfs snapshot -r "tank/test/encrypted-new@$ver"
|
||||
zfs snapshot -r "tank/test/encrypted-new@$ver"
|
||||
done
|
5
bin/create-test-setup/move-file
Executable file
5
bin/create-test-setup/move-file
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
dd if=/dev/urandom of=random\ 1M bs=1M count=1
|
||||
zfs snap tank/test@first
|
||||
mkdir subdir
|
||||
mv random\ 1M subdir/new✨name-1M
|
2
bin/create-test-setup/random-1M-file
Executable file
2
bin/create-test-setup/random-1M-file
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
dd if=/dev/urandom of=random-1M bs=1M count=1
|
2
bin/create-test-setup/zeros-1M-file
Executable file
2
bin/create-test-setup/zeros-1M-file
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
dd if=/dev/zero of=random-1M bs=1M count=1
|
2
bin/destroy-target
Executable file
2
bin/destroy-target
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
zfs destroy -r tank/target
|
2
bin/destroy-test
Executable file
2
bin/destroy-test
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
zfs destroy -r tank/test
|
3
bin/display-usage
Executable file
3
bin/display-usage
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
sync
|
||||
zfs list -o space
|
10
bin/reorganize-encrypted-nested
Executable file
10
bin/reorganize-encrypted-nested
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
rm -vrf /tank/test/encrypted/own-dataset
|
||||
rm -vrf /tank/test/encrypted/ver
|
||||
mv -v /tank/test/encrypted/should-be-root/* /tank/test/encrypted/
|
||||
rmdir /tank/test/encrypted/should-be-root
|
||||
zfs snapshot tank/test/encrypted@proper-root
|
||||
zfs rename tank/test/encrypted tank/test/encrypted-old
|
||||
zfs rename tank/test/encrypted-new tank/test/encrypted
|
||||
zfs rename tank/test/encrypted-old tank/test/encrypted/should-be-root
|
1
bin/zfs-diff-move
Symbolic link
1
bin/zfs-diff-move
Symbolic link
|
@ -0,0 +1 @@
|
|||
../external/zfs-diff-move/zfs-diff-move.sh
|
1
external/zfs-diff-move
vendored
Submodule
1
external/zfs-diff-move
vendored
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit a0ffdaed6c236f68e0ded1b1bede3be054ea725d
|
1
passphrase
Normal file
1
passphrase
Normal file
|
@ -0,0 +1 @@
|
|||
bad password
|
Loading…
Reference in New Issue
Block a user