summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-10-29 15:40:32 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-10-29 15:40:32 -0400
commit6c3b87f0de14d4545dc02484e8258fd863dcaf53 (patch)
treef49b977844fc52f587102cbe38a42d0d8392af16
parentf97c783283847c6cc4516673fe638b4d551e671d (diff)
add a tip
-rw-r--r--doc/tips/what_to_do_when_a_repository_is_corrupted.mdwn22
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/tips/what_to_do_when_a_repository_is_corrupted.mdwn b/doc/tips/what_to_do_when_a_repository_is_corrupted.mdwn
new file mode 100644
index 000000000..80cb046d9
--- /dev/null
+++ b/doc/tips/what_to_do_when_a_repository_is_corrupted.mdwn
@@ -0,0 +1,22 @@
+A git-annex repository on a removable USB drive is great, until the cable
+falls out at the wrong time and git's repository gets trashed. The way
+git checksums everything and the poor quality of USB media makes this
+perhaps more likely than you would expect. If this happens to you,
+here's a way to recover that makes the most of whatever data is left
+on the drive.
+
+* First, run `git fsck`. If it does not report any problems, your data
+ is fine, and you don't need to proceed further.
+* So `git fsck` says the git repository is corrupted. But probably the data
+ git-annex stored is fine. Your first step is to clone another copy
+ of the git repository from somewhere else. Let's call this clone
+ "$good", and the corrupted repository "$bad".
+* Preserve your git configuration changes, and the `annex.uuid` setting:
+ `mv $bad/.git/config $good/.git/config`
+* Move annexed data into the new repository: `mkdir $good/.git/annex; mv
+ $bad/.git/annex/objects $good/.git/annex/objects`
+* Reinitalize git-annex: `cd $good; git annex init`
+* Check for any problems with the annexed data: `cd $good; git annex fsck`
+* Now you can remove the corrupted repository, the new one is ready to use.
+
+--[[Joey]]