summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorGravatar anarcat <anarcat@web>2017-04-24 13:29:25 +0000
committerGravatar admin <admin@branchable.com>2017-04-24 13:29:25 +0000
commit1e889635df520108ce87179ce691f1b53bdeb75f (patch)
tree8fddb0386bf332a9b50e18904bdc904ccf994a48 /doc
parenta6d1c7d240955efab315a4c3638097579f0fbc23 (diff)
add zini's split repo procedure
Diffstat (limited to 'doc')
-rw-r--r--doc/tips/splitting_a_repository.mdwn56
1 files changed, 56 insertions, 0 deletions
diff --git a/doc/tips/splitting_a_repository.mdwn b/doc/tips/splitting_a_repository.mdwn
new file mode 100644
index 000000000..b904303a5
--- /dev/null
+++ b/doc/tips/splitting_a_repository.mdwn
@@ -0,0 +1,56 @@
+[[!meta title="Splitting a git-annex repository"]]
+
+I have a [git annex](https://git-annex.branchable.com/) repo for all my media
+that has grown to 57866 files and git operations are getting slow, especially
+on external spinning hard drives, so I decided to split it into separate
+repositories.
+
+This is how I did it, with some help from `#git-annex`. Suppose the old big repo is at `~/oldrepo`:
+
+```
+# Create a new repo for photos only
+mkdir ~/photos
+cd photos
+git init
+git annex init laptop
+
+# Hardlink all the annexed data from the old repo
+cp -rl ~/oldrepo/.git/annex/objects .git/annex/
+
+# Regenerate the git annex metadata
+git annex fsck --fast
+
+# Also split the repo on the usb key
+cd /media/usbkey
+git clone ~/photos
+cd photos
+git annex init usbkey
+cp -rl ../oldrepo/.git/annex/objects .git/annex/
+git annex fsck --fast
+
+# Connect the annexes as remotes of each other
+git remote add laptop ~/photos
+cd ~/photos
+git remote add usbkey /media/usbkey
+```
+
+At this point, I went through all repos doing standard cleanup:
+
+```
+# Remove unneeded hard links
+git annex unused
+git annex dropunused --force 1-12345
+
+# Sync
+git annex sync
+```
+
+To make sure nothing is missing, I used `git annex find --not --in=here`
+to see if, for example, the usbkey that should have everything could be missing
+some thing.
+
+Update: Antoine Beaupré pointed me to
+[this tip about Repositories with large number of files](http://git-annex.branchable.com/tips/Repositories_with_large_number_of_files/)
+which I will try next time one of my repositories grows enough to hit a performance issue.
+
+> This document was originally written by [Enrico Zini](http://www.enricozini.org/blog/2017/debian/splitting-a-git-annex-repository/) and added to this wiki by [[anarcat]].