I have an Ubuntu Server and one of its "tasks" is to mirror/backup files located on another server in a different location using rsync/rdiff-backup.
I know there are some conventions like web pages go in /var/www.
What is the best-practice/default location for storing the backup files?
Possible places I considered:
/var/backup – looks like it is used for internal backups of the OS
/home/backup – I could create this directory, but if maintaining backups is a "service" this server provides, I feel it is wrong to put the files in the same folder with personal user files
PS I am aware this question might be subjective (I got the warning tooltip), but I think what I do is quite common, and there has to be a convention.
Best Answer
There is a proper location.
There is a standard for proper filesystem structure. Its current version has been around for over a decade, which might be news to some Linux distros.
The latest version of the Filesystem Hierarchy Standard is 2.3: http://www.pathname.com/fhs/pub/fhs-2.3.html
There, under the "Purpose" section of
var
, it explains why that's a bad idea to use/var/backups
:The proper place would be, dependent on the application and its usage, something like:
(I say "something like" because whether you use
/var/lib
,/var/local
, or/var/opt
is dependent on the application, its role within the system, and how it was installed. Also, the structure under/var/lib/<app>
is arbitrary based on the application maintainers.)By the way, since you mentioned it,
/var/www
is not the proper place for served web pages (again, this is news to some distro and package maintainers, but the FHS is older that many of them who clearly never have read it). Served content, and stored application data/assets for services belong under the/srv
directory. I have been using the protocol method since 2005 and find it works quite well (/srv/http
,/srv/ftp
,/srv/git
,/srv/svn
, etc.).Let's say that that you are using
rsync
and that this machine is providing a backup service for the network, you would use:UPDATE
Version 3.0 of FHS: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html