Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

There's a system-created /var/backups directory on Debian-based systems. I need a place to store backups of several git repositories (the primaries are on bitbucket). If I store them in /var/backup/git will that break apt-get, or will they get automatically deleted at inopportune times? Is there any reason I shouldn't use /var/backup? If there is, what is a reasonable alternative?

share|improve this question
It is not dangerous to do so. – fpmurphy1 Mar 21 '13 at 16:31
up vote 15 down vote accepted

/var/backups is specific to Debian. It is not specified in the FHS, and its use is not documented in Debian policy (See Debian Bug report logs - #122038). The behavior is described in http://ubuntuforums.org/showthread.php?t=1232703.

While I agree with @fpmurphy that there is little danger of Debian ever removing your backup files in /var/backup, I think that it is not good policy to use a directory that is so Debian-specific. For one, Debian might change its policy and break things. For another, the user community already has specific expectations about what the directory is for. And finally, because it is not "portable" in the sense that it is not clear where this directory would be in a non-Debian distribution.

If my understanding of the FHS is correct, it would be appropriate to put clones of Git repositories in /opt/<project_name>/.git or in /usr/local/src/<project_name/.git. My personal inclination would be to use the former because it leaves the door open to backup project resources that are not source files and therefore not in Git.

If you really want to emphasis the backup nature of these repositories, you could put them in /backups, or even /home/backups, two directory names that are often used as mount points for external storage.

share|improve this answer
/var/backups actually is mentioned in FHS. It says that the directory is "reserved", but not much else: refspecs.linuxfoundation.org/FHS_2.3/… – Ajedi32 Aug 12 '15 at 16:16

Nowadays, it seems the FHS suggests you can freely create whatever subdirectory under /srv, e.g. /srv/archives/bitbucket.
What I don't find really clear with the FHS definition is that backups aren't files "served by the system". Anyway, /srv is a free namespace.

share|improve this answer

The best way to backup git repositories is to have a (bare) clone of the repository. git is quite frugal in its space usage, there will be almost no gain in compressing anything there. And a clone can easily be kept up to date (unless upstream does stupid pranks like wholesale history rewriting, nothing can be lost).

share|improve this answer
A git clone is a mirror, not a backup. Backup must preserve history. Although a version controller repository is itself designed to store history, as you wrote, it is not completely immune to failures/mistakes. See taobackup.com/history.html – Hontvári Levente Dec 3 '14 at 17:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.