{"id":1787,"date":"2022-04-04T06:39:02","date_gmt":"2022-04-04T06:39:02","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=1787"},"modified":"2022-12-23T06:19:54","modified_gmt":"2022-12-23T06:19:54","slug":"how-can-i-validate-a-svn-servers-back-up-and-rest","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/how-can-i-validate-a-svn-servers-back-up-and-rest\/","title":{"rendered":"SVN Server Backup and Restore Guide and Tutorials"},"content":{"rendered":"\n\n\n<h2 class=\"wp-block-heading\">Backup a local SVN repository over a SSH Console<\/h2>\n\n\n\n<p>The backup is done on the SSH console by using the SVN dump command specifying a file into which should be saved.<\/p>\n\n\n\n<p>$ svnadmin dump \/path\/to\/repository &gt; svnexport.dump<\/p>\n\n\n\n<p>The created file svnexport.dump now contains the complete repository with all revisions.<br>Please note that no hooks are secured with this SVN backup. These are located in the folder \/ PathToRepository \/ hooks and should be saved manually.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to restore a local SVN repository by a SSH Console<\/h2>\n\n\n\n<p>The import of the dump file is just as easy, but of course must be a existing repository. If the SVN repository is not yet available use svnadmin create \/path\/to\/repository.<br>Furthermore, it does not have to be imported in the same SVN repository path as the path from which the SVN repository was exported.<\/p>\n\n\n\n<p>$ svnadmin load \/path\/to\/repository &lt; svnexport.dump<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Compressed SVN Dump and Restore<\/h2>\n\n\n\n<p>As usually the dumps can be very large files, it is advisable to compress the dump. This can be done in a simple line at the command shell and this saves typically more than 50% of disk space.<\/p>\n\n\n\n<p>svnadmin dump \/path\/to\/repository | gzip -9 &gt; svnexport.dump<\/p>\n\n\n\n<p>The restore of a gzip compressed SVN repository is also possible as a simple one-liner.<\/p>\n\n\n\n<p>gunzip -c svnexport.dump | svnadmin load \/path\/to\/repository<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Backup a Remote SVN Repository<\/h2>\n\n\n\n<p>Backing up is also done on a console using SSH svnrdump.<br>All you need is the URL of the repository, and as before, the file name for the dump.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">svnrdump dump http:<span class=\"hljs-comment\">\/\/domain.tld\/repo &gt; svnexport.dump<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>If you need to authenticate with user and password against your SVN repository, use this command.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">svnrdump dump http:<span class=\"hljs-comment\">\/\/domain.tld\/repo &gt; svnexport.dump --username admin --password admin --non-interactive<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The created file svnexport.dump now contains all the repository revisions.<br>The remote SVN export is only possible with remote SVN servers from version 1.4!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Restore remote SVN repository<\/h2>\n\n\n\n<p>The import of the dump file is just as easy, but of course it must be existing repository.<br>For remote import into a SVN server, at least SVN server version 1.7 is required.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">svnrdump load http:<span class=\"hljs-comment\">\/\/domain.tld\/repo &lt; svnexport.dump<\/span>\n<span class=\"hljs-comment\"># or, if the username and password are required<\/span>\nsvnrdump load http:<span class=\"hljs-comment\">\/\/domain.tld\/repo &lt; svnexport.dump --username admin --password admin --non-interactive<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In the best case will now start the import and all is well.<br>But in 99.99% of all cases you obtained now this error:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">svnrdump: E175002: DAV request failed; it<span class=\"hljs-string\">'s possible that the repository'<\/span>s pre-revprop-change hook either failed or is non-existent\n<span class=\"hljs-attr\">svnrdump<\/span>: E175008: At least one property change failed; repository is unchanged\n<span class=\"hljs-attr\">svnrdump<\/span>: E175002: <span class=\"hljs-built_in\">Error<\/span> setting property <span class=\"hljs-string\">'rdump-lock'<\/span>:\nRepository has not been enabled to accept revision propchanges;\nask the administrator to create a pre-revprop-change hook<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this case, the target SVN repository hook &#8216;pre-revprop-change&#8217; must be installed.<br>This is of course only possible if you have access to the file system at the target.<br>In the Hook directory the executable file pre-revprop-change with Exit 0 have to be created.<br>Use the following one-liner to create the hook script and make it executable.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">printf <span class=\"hljs-string\">'#!\/bin\/sh\\nexit 0'<\/span> &gt; <span class=\"hljs-regexp\">\/path\/<\/span>to\/repository\/hooks\/pre-revprop-change &amp;&amp; chmod +x \/path\/to\/repository\/hooks\/pre-revprop-change<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Now the remote SVN import should work without any problem.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Backup a local SVN repository over a SSH Console The backup is done on the SSH console by using the SVN dump command specifying a file into which should be&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[2],"tags":[395],"class_list":["post-1787","post","type-post","status-publish","format-standard","hentry","category-uncategorised","tag-svn"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/1787","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=1787"}],"version-history":[{"count":2,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/1787\/revisions"}],"predecessor-version":[{"id":29437,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/1787\/revisions\/29437"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=1787"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=1787"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=1787"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}