summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2022-06-26 19:57:21 -0600
committerLuke Shumaker <lukeshu@lukeshu.com>2022-06-26 19:57:21 -0600
commit09e3317a433add776d6539abcd7cf4f00ca984e5 (patch)
treeb692d7433f822126ffa539da65323f3c7662c391 /scripts
parent502cdc72771de93ce41e2a00bc201fc488603f59 (diff)
add scripts
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/diff-dump-tree.sh4
-rw-r--r--scripts/dump-tree-diff.sh5
-rwxr-xr-xscripts/run-chunk-recover.sh7
-rwxr-xr-xscripts/run-fsck.sh8
4 files changed, 24 insertions, 0 deletions
diff --git a/scripts/diff-dump-tree.sh b/scripts/diff-dump-tree.sh
new file mode 100755
index 0000000..588242f
--- /dev/null
+++ b/scripts/diff-dump-tree.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+diff -u \
+ <(../btrfs-progs/btrfs inspect dump-tree --noscan ../scratch/new.img | sed -e 's/ UNKNOWN.0 / UNTYPED /g' -e 's/\b18446744073709551615\b/-1/g') \
+ <(go run ./cmd/btrfs-dump-tree/ ../scratch/new.img)
diff --git a/scripts/dump-tree-diff.sh b/scripts/dump-tree-diff.sh
new file mode 100644
index 0000000..9e650f3
--- /dev/null
+++ b/scripts/dump-tree-diff.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+make -C ../btrfs-progs
+diff -u \
+ <(../btrfs-progs/btrfs inspect dump-tree --noscan ../scratch/new.img | sed -e 's/ UNKNOWN.0 / UNTYPED /g' -e 's/\b18446744073709551615\b/-1/g') \
+ <(go run ./cmd/btrfs-dump-tree/ ../scratch/new.img)
diff --git a/scripts/run-chunk-recover.sh b/scripts/run-chunk-recover.sh
new file mode 100755
index 0000000..f9a93d3
--- /dev/null
+++ b/scripts/run-chunk-recover.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+set -e
+rm -f ../scratch/dump-scratch.img
+cp --reflink=always ../scratch/dump-{zero,scratch}.img
+chmod 600 ../scratch/dump-scratch.img
+make -C ../btrfs-progs
+time ../btrfs-progs/btrfs rescue chunk-recover ../scratch/dump-scratch.img
diff --git a/scripts/run-fsck.sh b/scripts/run-fsck.sh
new file mode 100755
index 0000000..312676e
--- /dev/null
+++ b/scripts/run-fsck.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+set -e
+rm -f ../scratch/dump-scratch.img
+cp --reflink=always ../scratch/dump-{zero,scratch}.img
+chmod 600 ../scratch/dump-scratch.img
+time go run ./cmd/btrfs-fsck ../scratch/dump-scratch.img
+#make -C ../btrfs-progs
+#time ../btrfs-progs/btrfs rescue chunk-recover ../scratch/dump-scratch.img