<p>Is it possible to use <a href="http://subversion.apache.org/" rel="noreferrer">Apache Subversion</a> (SVN) as general purpose backup tool? (As a kind of <a href="http://en.wikipedia.org/wiki/Rsync" rel="noreferrer">rsync</a> alternative.)</p>

[{'answer_id': 61890, 'author': 'Tim Williscroft', 'author_id': 2789, 'author_profile': 'https://Stackoverflow.com/users/2789', 'pm_score': 0, 'selected': False, 'text': "<p>I've used CVS as a substitute for ghost so I don't see why not.</p>\n\n<p>I'ts nice as you can tag a baseline: you can change manage machines.</p>\n\n<p>This works better on unixes than windows, obviously.</p>\n"}, {'answer_id': 61891, 'author': 'Kendall Helmstetter Gelner', 'author_id': 6330, 'author_profile': 'https://Stackoverflow.com/users/6330', 'pm_score': 0, 'selected': False, 'text': "<p>The thing that would put me off that idea, is that for general use any binary data would get copied over anytime it changed, whereas the text content SCM systems are based around can easily be updated in the form of diffs.</p>\n\n<p>So you could do it, just be aware you may not want to use it to manage things like photo repositories if you do much editing.</p>\n\n<p>The nice thing about more general purpose backup solutions (say, Time Machine) is that they  can roll up multiple binary changes after a while to conserve space.  I'm not sure how easy that would be to do in SVN or git or mercurial.</p>\n"}, {'answer_id': 61892, 'author': 'Alex Duggleby', 'author_id': 5790, 'author_profile': 'https://Stackoverflow.com/users/5790', 'pm_score': 2, 'selected': False, 'text': '<p>One thing to bear in mind when using SVN as a backup for binary files is that SVN will double the size of your files, because it keeps a local copy of each file (in the .svn/text-base) file.</p>\n\n<p>Apart from that I use SVN for a backup as well. Simply add all files then commit via script. </p>\n'}, {'answer_id': 61895, 'author': 'readonly', 'author_id': 4883, 'author_profile': 'https://Stackoverflow.com/users/4883', 'pm_score': 4, 'selected': True, 'text': '<p>I found this article to be a pretty cool description of using svn to backup your home directory, and more:</p>\n<blockquote>\n<p>I use Subversion to backup my Linux boxes. With some minor creativity, it easily covers:</p>\n<ul>\n<li>Daily snapshots and offsite backup.</li>\n<li>Easy addition and removal of files and folders.</li>\n<li>Detailed tracking of file versions.</li>\n</ul>\n<p>It also allows for a few bonus features:</p>\n<ul>\n<li>Regular log emails to keep track of filesystem activity via Subversion\'s event hooks.</li>\n<li>Users may request a checkout of their home folders from any respository revision.</li>\n<li>New or replacement servers can be setup with a few svn checkout commands.</li>\n</ul>\n</blockquote>\n<p>Source: <a href="http://web.archive.org/web/20080824094836/http://www.mythago.net/svn_for_backup.html" rel="nofollow noreferrer">http://www.mythago.net/svn_for_backup.html</a></p>\n<p>Also found <a href="http://www.onlamp.com/pub/a/onlamp/2005/01/06/svn_homedir.html" rel="nofollow noreferrer">this article</a> which shows an example of versioning your home directory.  This allows you to bring your environment with you by checking out your home directory into a new machine.  I used to do something similar and found it very useful.</p>\n'}, {'answer_id': 61950, 'author': 'Mo.', 'author_id': 1870, 'author_profile': 'https://Stackoverflow.com/users/1870', 'pm_score': 1, 'selected': False, 'text': "<p>One thing, that would annoy me a lot, are the '.svn' folders, that svn puts into every folder it tracks. </p>\n\n<p>They look annoying, when you copy a folder, you should remember to not copy them (or your sandbox might be irritated) and it is a lot harder to grep through a bunch of folders, since there are often a lot of hits in the .svn resource folders.</p>\n\n<p>I like the idea of using a source-control, to control your environment. But I personally  would not choose svn for this job. I would go for something like git. But that is probably just me...</p>\n"}, {'answer_id': 63570, 'author': 'Mark Elder', 'author_id': 6174, 'author_profile': 'https://Stackoverflow.com/users/6174', 'pm_score': 0, 'selected': False, 'text': '<p>Using SVN for backups can work.  However, over time it can be difficult to delete old revisions that are not needed.  Say you only wanted to keep 30 or 60 days of backups.  SVN does not provide an easy way to remove any history older than X days.  If you don\'t have a way to purge old history you will eventually run your backup drive out of space.</p>\n\n<p>Here is a quote from the <a href="http://svnbook.red-bean.com/en/1.0/ch05s03.html#svn-ch-5-sect-3.1.3" rel="nofollow noreferrer">SVN Book on the svndumpfilter</a> command:</p>\n\n<blockquote>\n  <p>Since Subversion stores everything in\n  an opaque database system, attempting\n  manual tweaks is unwise, if not quite\n  difficult. And once data has been\n  stored in your repository, Subversion\n  generally doesn\'t provide an easy way\n  to remove that data. [13]</p>\n  \n  <blockquote>\n    <p>[13] That, by the way, is a feature, not a bug.</p>\n  </blockquote>\n</blockquote>\n\n<p>I found <a href="http://www.cis.upenn.edu/~bcpierce/unison/" rel="nofollow noreferrer">unison</a> to be a better option than svn for a rsync alternative.</p>\n'}, {'answer_id': 63682, 'author': 'Fred Yankowski', 'author_id': 7887, 'author_profile': 'https://Stackoverflow.com/users/7887', 'pm_score': 0, 'selected': False, 'text': "<p>Backing up /etc with source code control can be a big help when you want to revert a change that hosed your system, experiment with changes, or carry changes from one server to another.  </p>\n\n<p>But subversion's multitude of .svn directories can get in the way for that, not just when searching but in some cases, like *.d folders, poorly designed systems might interpret the .svn folders themselves as containing configuration data.</p>\n\n<p>I now prefer using Mercurial for backing up /etc since it puts a single .hg folder under /etc.  For real backup and not just version control you need to copy that .hg folder elsewhere.</p>\n"}, {'answer_id': 66021, 'author': 'nickf', 'author_id': 9021, 'author_profile': 'https://Stackoverflow.com/users/9021', 'pm_score': 2, 'selected': False, 'text': '<p>As a "general purpose" backup, I\'d say it\'s probably not the greatest idea, mainly for the reasons given by others (lots of excess folders and wasted disk space). If you want to just keep backups, again I\'d say there\'s probably better options, depending on your needs, eg: do you need to keep every single version of every single file, or would certain snapshots of your data be sufficient?</p>\n\n<p>However, at my office, we have a small team of 6 who work with shared files (eg: policies and procedures manuals, registration forms, etc). A lot of the time, team members will be working remotely (from home or while travelling), and often offline. Rather than using a central shared-folder setup, we use SVN to give each person an entire working copy of the folder which they can work on and refer to and synchronise whenever possible. This kills two birds with one stone: everyone can access and edit the files even while offline, plus it gives us really great redundancy in our backups. If my laptop <a href="http://www.youtube.com/watch?v=4XHaz5EM9jc" rel="nofollow noreferrer">catches on fire</a>, it\'s no hassle because I can just check out another copy (obviously on another computer). If the server catches on fire, we\'ll have the backups of the repository to restore. If the server AND all the repo backups catch on fire, then all that you\'ve lost are old versions of files. The only way that you\'ll lose any current data is if the server, your repo backups and every single computer which has a checkout all mysteriously catch on fire.</p>\n\n<p>As some people have said though, SVN will never remove information from the repository, meaning that if you only want to keep backups for 60 days, then, well, you can\'t. This isn\'t exactly true. Through use of <a href="http://svnbook.red-bean.com/en/1.0/re10.html" rel="nofollow noreferrer">export</a>, <a href="http://svnbook.red-bean.com/en/1.1/re31.html" rel="nofollow noreferrer">dump</a> and <a href="http://svnbook.red-bean.com/en/1.0/re12.html" rel="nofollow noreferrer">import</a> you could effectively wipe out older versions of files. It\'s not pretty, but it\'s possible.</p>\n'}, {'answer_id': 2781239, 'author': 'JoaoPSF', 'author_id': 334446, 'author_profile': 'https://Stackoverflow.com/users/334446', 'pm_score': 1, 'selected': False, 'text': "<p>I do use SVN to backup my computer, and also to synchronize my laptop and my desktop. But it does have the problems mentioned in earlier answers, mainly the doubling of the disk usage. I also feel that the excess of files and the SVN process constantly checking my HD for changes makes my machine slower.</p>\n\n<p>I would like to highlight, however, that SVN is great for synching different machines, and you also get the bonus of being able to check out a file anywhere if you need to -- I even do it in my browser through the web interface, sometimes.</p>\n\n<p>In summary, I have mixed feelings about using SVN for general purpose backup. But if you do, I recommend <strong><em>not</em></strong> to store libraries such as movies, photos and music, because they tend to be large (suffering hugely from the doubled space usage) and immutable -- you don't need a versioning system for that, because in the rare occasions when you change a file, you generally don't need the old versions (and SVN isn't good at making/storing diffs of binary files, it saves the entire new version of the file). So, unless SVN can be adapted (a long-time project intention of mine) for these cases, I suggest using an alternative method for backing up these kinds of files.</p>\n"}, {'answer_id': 4185154, 'author': 'Wolfram Aulenbach', 'author_id': 391233, 'author_profile': 'https://Stackoverflow.com/users/391233', 'pm_score': 0, 'selected': False, 'text': '<p>This statement by JoaoPSF is incorrect:</p>\n\n<blockquote>\n  <p>(and SVN isn\'t good at making/storing diffs of binary files, it saves the entire new version of the file)</p>\n</blockquote>\n\n<p>See this quote from <a href="http://help.collab.net/index.jsp?topic=/faq/svnbinary.html" rel="nofollow">How does Subversion handle binary files</a>:</p>\n\n<blockquote>\n  <p>Note that whether or not a file is binary does not affect the amount of repository space used to store changes to that file, nor does it affect the amount of traffic between client and server. For storage and transmission purposes, Subversion uses a diffing method that works equally well on binary and text files; this is completely unrelated to the diffing method used by the svn diff command. </p>\n</blockquote>\n'}, {'answer_id': 15548768, 'author': 'user2195264', 'author_id': 2195264, 'author_profile': 'https://Stackoverflow.com/users/2195264', 'pm_score': 1, 'selected': False, 'text': '<p>To use SVN as backup on Linux do the following:</p>\n\n<ol>\n<li>Create an empty repo.</li>\n<li>Checkout the empty repository into the folder tree you want to backup.</li>\n<li>Use the following code snippet (svnauto). You have to replace "myuser" and "mypassword" with valid credentials for your repository:</li>\n</ol>\n\n<pre>\n    #!/bin/sh\n    svn status --depth=infinity --username=myuser --password=mypassword > /tmp/svnauto_tmp.list\n    cat /tmp/svnauto_tmp.list | grep \'^?\' | sed -e \'s/^?       /svn add --depth=infinity --force --username=myuser --password=mypassword "/g\' -e \'s/$/@"/g\' | sh\n    cat /tmp/svnauto_tmp.list | grep \'^!\' | sed -e \'s/^!       /svn delete --username=myuser --password=mypassword "/g\' -e \'s/$/@"/g\' | sh\n    rm -f /tmp/svnauto_tmp.list\n    svn update . --username=myuser --password=mypassword\n    svn commit --username=myuser --password=mypassword --message "Automatic backup"\n</pre>\n\n<p>The script above will add/remove and update any files and subdirectories within the current dir. To use it simply <code>cd</code> to the folder you want to backup (which must be a working copy of course), and run <code>svnauto</code>. Notice that you need to have grep and sed installed on your system, and it creates a temporary file in /tmp. It can be used from a cron job for nightly commit, using the following cron script:</p>\n\n<pre><code>#!/bin/sh\nexport LANG=en_US.UTF-8 &amp;&amp; cd /my/directory &amp;&amp; echo Starting backup $(date) &gt; /root/backup_log.txt &amp;&amp; /root/svnauto &gt;&gt; /root/backup_log.txt 2&gt;&amp;1 &amp;&amp; echo Finished backup. &gt;&gt; /root/backup_log.txt &amp;&amp; cat /root/backup_log.txt\n</code></pre>\n\n<p>This cron script assumes that <code>/my/directory</code> is the folder you want to backup (replace as needed). It also assumes you put the <code>svnauto</code> script in <code>/root</code>. It creates a log and displays it at the end. One more detail: the first <code>export</code> is needed for svn to find the proper language. You may have to adjust this line to your own local language to make it work.</p>\n'}, {'answer_id': 15642489, 'author': 'Petr', 'author_id': 1333025, 'author_profile': 'https://Stackoverflow.com/users/1333025', 'pm_score': 1, 'selected': False, 'text': '<p>You could also consider <a href="https://github.com/bup/bup" rel="nofollow">bup</a> - <em>Highly efficient file backup system based on the git packfile format.</em> It\'s based on git\'s in the way it stores data, which is very efficient for storing files and their differences.</p>\n'}]
['https://Stackoverflow.com/questions/61888', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1897/']