Git-annex Repository on an External Hard Drive
Git-annex offers different groups of repositories. A significant group are Backup Repositories. The group chooses rules which file contents remain in the repository and which are used in other repositories. When you call up the git-annex command in the automatic mode (--auto) or if the background service git-annex assistant is running, the rules come into play. In the case of a group backup repo saves all file contents by an automatic drop in the repo.[1]
The following article explains how a Git-annex group backup repo on an external hard drive is created.
Creating a Git-annex Repo
In the first step, a git-annex repo is created:
:~/annex$ git init
Initialized empty Git repository in /home/alice/annex/.git/
:~/annex$ git annex init Alice
init Alice ok
(Recording state in git...)
:~/annex$ cp ~/Downloads/Detecting_Intruders_Intro.pdf .
:~/annex$ git annex add .
:~/annex$ git commit -a -m "Added pdf"
[master (root-commit) 3b6dc55] Added pdf
1 file changed, 1 insertion(+)
create mode 120000 Detecting_Intruders_Intro.pdf
Configuring an External Hard Drive
The repo is cloned from the home directory on the hard drive:
:/media/drive/annex$ git clone ~/annex .
Cloning into '.'...
done.
Setting Backup
The external hard drive is added remotely and starts synchronization:
:~/annex$ git remote add usb /media/drive/annex
:~/annex$ git annex sync usb
The USB drive is added to the git-annex backup group. As a result, the internal rules from git-annex take hold to preserve the files with drop and copy commands.
:~/annex$ git annex group usb backup
group usb ok
(Recording state in git...)
:~/annex$ git annex content usb standard
content usb ok
(Recording state in git...)
:~/annex$ git annex describe usb "backup drive"
Per git annex copy the files are copied to the external hard drive:
:~/annex$ git annex sync
:~/annex$ git annex copy --auto --to usb
copy Detecting_Intruders_Intro.pdf (to usb...)
SHA256E-s66060--6330d3dae2e5105a4c4ec3c16d6781ff7168505ab4a203fa381264c9b19368ad.pdf
66060 100% 31.75MB/s 0:00:00 (xfer#1, to-check=0/1)
sent 66216 bytes received 31 bytes 132494.00 bytes/sec
total size is 66060 speedup is 1.00
ok
(Recording state in git...)
The new git annex sync contents have been merged into the repo on the external hard drive:
:/media/drive/annex$ git annex sync
References
- ↑ git-annex preferred content (git-annex.branchable.com)
Author: Georg Schönberger