summaryrefslogtreecommitdiff
path: root/doc/todo
diff options
context:
space:
mode:
authorGravatar baffo32 <baffo32@web>2016-06-17 23:55:52 +0000
committerGravatar admin <admin@branchable.com>2016-06-17 23:55:52 +0000
commitef466040ebf5eece227e677c796fc5b477264bda (patch)
tree9b68ff16468a5bcb87542c8f840166f88e78e463 /doc/todo
parent363f09adafe770c98d01ac691001ef6b8fec776e (diff)
Added a comment: Use-case expansion
Diffstat (limited to 'doc/todo')
-rw-r--r--doc/todo/Log_function_to_enumerate_all_recent_git-annex_changes/comment_1_1b1439d08fd064314e28f94caaa850be._comment28
1 files changed, 28 insertions, 0 deletions
diff --git a/doc/todo/Log_function_to_enumerate_all_recent_git-annex_changes/comment_1_1b1439d08fd064314e28f94caaa850be._comment b/doc/todo/Log_function_to_enumerate_all_recent_git-annex_changes/comment_1_1b1439d08fd064314e28f94caaa850be._comment
new file mode 100644
index 000000000..c03673f06
--- /dev/null
+++ b/doc/todo/Log_function_to_enumerate_all_recent_git-annex_changes/comment_1_1b1439d08fd064314e28f94caaa850be._comment
@@ -0,0 +1,28 @@
+[[!comment format=mdwn
+ username="baffo32"
+ subject="Use-case expansion"
+ date="2016-06-17T23:55:52Z"
+ content="""
+My use-case is to store the absolute disk offsets for files, to aid recovery in case of accidental loss.
+
+I'd like to run a script for every key added to the repo in which the script resides. The script calls filefrag to determine the physical location of the key on the disk and adds it as metadata.
+
+If interested, my pre-commit-annex snippet is:
+
+ # requires recent e2fsprogs
+ if [ -x /usr/sbin/filefrag ]
+ then
+ field=\"$(git config annex.uuid)\"-extents
+ LC_ALL=C /usr/sbin/filefrag -ev \"$f\" | sed -n \
+ -e 's/.*([0-9]* blocks* of \([0-9]*\) bytes).*/!bs \1/p'\
+ -e 's/^ *[0-9]*: *\([0-9]*\)\.\. *[0-9]*: *\([0-9]*\)\.\. *[0-9]*: *\([0-9]*\): *.*/\1 \2 \3/p' |
+ while read value
+ do
+ # !bs 4096 means values are in multiples of 4096 bytes (blocksize)
+ # 0 5287839 5 means 5 blocks starting at block 0 of the file start at block 5287839 of the disk
+ # extents which are not listed are from sparse files and contain all zeros
+ equal='+=' addmeta \"$f\" \"$field\" \"$value\"
+ done
+ fi
+
+"""]]