{"id":440,"date":"2011-11-15T20:53:00","date_gmt":"2011-11-16T01:53:00","guid":{"rendered":"http:\/\/www.diyode.com\/?p=440"},"modified":"2011-11-28T18:03:02","modified_gmt":"2011-11-28T23:03:02","slug":"backup-your-mac-to-remote-server","status":"publish","type":"post","link":"https:\/\/diyode.com\/blog\/2011\/11\/backup-your-mac-to-remote-server\/","title":{"rendered":"Backup your Mac to remote server"},"content":{"rendered":"<p>There are quite a few examples out there in how to use rsync to duplicate how Timemachine does its backups.<\/p>\n<p>This is the article which first inspired me. <a title=\"(rsync_time_machine)\" href=\"http:\/\/blog.interlinked.org\/tutorials\/rsync_time_machine.html\" target=\"_blank\">http:\/\/blog.interlinked.org\/tutorials\/rsync_time_machine.html<\/a><\/p>\n<p>But I still had some problems with it. Firstly you either had to pull the backup from the Mac. My Mac is not on all the time. Least of all at night when backups are normally made.<\/p>\n<p>The other option pushed the backup from the Mac but then you had to have SSH access to the Linux server that you were backing up to. Difficult to setup and not too secure because of the public\/private key authentication scheme to avoid typing in your password.<\/p>\n<p>So this is what I came up with.<\/p>\n<p>&nbsp;<\/p>\n<h2>Rsync Server on Linux:<\/h2>\n<p>The first thing you should setup is a Linux server that has plenty disk for the backups and has rsync installed. Your Mac(s) will be connecting to this server with rsync and transferring files to it.<\/p>\n<p>I&#8217;m not going to do through the whole rsync installation. There are quite a few guides on the Internet for that. I will just describe my setup and leave you to fill in the rest.<\/p>\n<p>I am using Debian 5.0 with rsync\u00a0 version 3.0.3.<\/p>\n<p>Here is what my \/etc\/rsyncd.conf<br \/>\n<pre class=\"preserve-code-formatting\">######\nuid = root\ngid = backup\nuse chroot = yes\nmax connections = 4\nsyslog facility = local5\npid file = \/var\/run\/rsyncd.pid\n[mac]\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 path = \/Public\/Backup-Mac\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 comment = Backup directory for Bunny&#039;s Mac\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 read only = false\n######<\/pre><br \/>\nThat requires a bit of explaining.<\/p>\n<p>I am using &#8216;chroot&#8217; which I am told is more secure. If you want to be even more secure I would suggest you change the &#8216;uid&#8217; and &#8216;gid&#8217; to something other than &#8216;root&#8217;.<\/p>\n<p>You will notice that I am using rsync &#8216;modules&#8217;. The [mac] portion is sort of like a Samba mount for rsync and it defines where the Mac&#8217;s will be putting their files. Read up on rsync &#8216;modules&#8217; as they really are powerful.<\/p>\n<p>I have a 2 TB disk mounted on \/media\/Backup-Mac which is where rsync will put all the Mac&#8217;s backup files. Here is what the disk looks like.<br \/>\n<pre class=\"preserve-code-formatting\">######<\/pre><br \/>\n<pre class=\"preserve-code-formatting\">drwxr-xr-x 9 root root\u00a0\u00a0\u00a0 4096 2011-11-15 12:15 .\ndrwxr-xr-x 4 root root\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0 2011-11-15 16:20 ..\ndrwxr-xr-x 3 root backup\u00a0 4096 2011-10-12 14:48 backup-2011-11-12\ndrwxr-xr-x 3 root backup\u00a0 4096 2011-10-13 09:03 backup-2011-11-13\ndrwxr-xr-x 3 root backup\u00a0 4096 2011-10-14 09:37 backup-2011-11-14\ndrwxr-xr-x 3 root backup\u00a0 4096 2011-11-15 10:43 backup-2011-11-15\nlrwxrwxrwx 1 root root\u00a0\u00a0\u00a0\u00a0\u00a0 17 2011-11-15 12:17 current -&amp;gt; backup-2011-11-15\ndrwx------ 2 root root\u00a0\u00a0 16384 2011-10-12 14:35 lost+found<\/pre><br \/>\n######<\/p>\n<p>That&#8217;s it for the Linux side.<\/p>\n<h2>Mac client side:<\/h2>\n<p>The real power of rsync is it will synchronize 2 directories very efficiently. It only transfers the changes and nothing else. The initial sync can take a long time but from there it is very fast in keeping things the same. Great for the WiFi link I use.<\/p>\n<p>The other power of rsync is it&#8217;s ability to use hardlinks for incremental backups. That means that you can have what appears to be &#8216;snapshots&#8217; of your files from a series of days but they take up only as much space as 1 complete backup plus the daily changes. See the article above for details on how rsync uses hardlinks.<\/p>\n<p>The benefit of using hardlinks is when you take a look at one days backup you have the entire files structure just as it would have been on you Mac. This makes retrieving files as easy as navigating the directories.<\/p>\n<p>Here is the script that I use on the Mac side:<br \/>\n<pre class=\"preserve-code-formatting\">######<\/pre><br \/>\n<pre class=\"preserve-code-formatting\">#!\/bin\/sh\n\nDATE=$(date &quot;+%Y-%m-%d&quot;)\nHOST=&quot;tecra&quot;\nMODULE=&quot;mac&quot;\nBWLIMIT=&quot;5000&quot;\n\nREMOTE_DIR=&quot;backup-$DATE&quot;\n\nLOCAL_DIR=&quot;\/Users&quot;\n\nrsync -azP --bwlimit=$BWLIMIT --link-dest=\/current\u00a0 --exclude-from=\/etc\/rsync.exclude $LOCAL_DIR $HOST::$MODULE\/$REMOTE_DIR\n\ncd \/var\/tmp\nmkdir current\ncd current\nrsync -rv --delete --include=current &#039;--exclude=*&#039; . $HOST::$MODULE\nln -s backup-$DATE .\/current\nrsync -azP current $HOST::$MODULE\ncd \/\nrm -rf \/var\/tmp\/current\n#####<\/pre><br \/>\nThe meat of the script is the &#8216;rsync&#8217; line. It is similar to most of the other examples on the Internet. I use &#8216;bwlimit&#8217; to make sure I don&#8217;t swamp the WiFi link with the backup.<\/p>\n<p>Most, if no all, people use SSH to create the &#8216;current&#8217; link on the remove server. I figured out a way to do it just via rsync. The bit after the rsync command is where it gets done.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are quite a few examples out there in how to use rsync to duplicate how Timemachine does its backups. This is the article which first inspired me. http:\/\/blog.interlinked.org\/tutorials\/rsync_time_machine.html But I still had some problems with it. Firstly you either had to pull the backup from the Mac. My Mac is not on all the [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[13],"tags":[39,42,43,40,41],"class_list":["post-440","post","type-post","status-publish","format-standard","hentry","category-computers","tag-linux","tag-mac","tag-rsync","tag-samba","tag-time-machine"],"featured_image_src":null,"author_info":{"display_name":"Mark Zander","author_link":"https:\/\/diyode.com\/blog\/author\/mark-zander\/"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Backup your Mac to remote server - DIYode Community Workshop<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/diyode.com\/blog\/2011\/11\/backup-your-mac-to-remote-server\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Backup your Mac to remote server - DIYode Community Workshop\" \/>\n<meta property=\"og:description\" content=\"There are quite a few examples out there in how to use rsync to duplicate how Timemachine does its backups. This is the article which first inspired me. http:\/\/blog.interlinked.org\/tutorials\/rsync_time_machine.html But I still had some problems with it. Firstly you either had to pull the backup from the Mac. My Mac is not on all the [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/diyode.com\/blog\/2011\/11\/backup-your-mac-to-remote-server\/\" \/>\n<meta property=\"og:site_name\" content=\"DIYode Community Workshop\" \/>\n<meta property=\"article:published_time\" content=\"2011-11-16T01:53:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2011-11-28T23:03:02+00:00\" \/>\n<meta name=\"author\" content=\"Mark Zander\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mark Zander\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/diyode.com\\\/blog\\\/2011\\\/11\\\/backup-your-mac-to-remote-server\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/diyode.com\\\/blog\\\/2011\\\/11\\\/backup-your-mac-to-remote-server\\\/\"},\"author\":{\"name\":\"Mark Zander\",\"@id\":\"https:\\\/\\\/diyode.com\\\/blog\\\/#\\\/schema\\\/person\\\/e77b70fd76b8b623d4abc68c53250bc3\"},\"headline\":\"Backup your Mac to remote server\",\"datePublished\":\"2011-11-16T01:53:00+00:00\",\"dateModified\":\"2011-11-28T23:03:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/diyode.com\\\/blog\\\/2011\\\/11\\\/backup-your-mac-to-remote-server\\\/\"},\"wordCount\":577,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/diyode.com\\\/blog\\\/#organization\"},\"keywords\":[\"linux\",\"mac\",\"rsync\",\"samba\",\"time machine\"],\"articleSection\":[\"Computers\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/diyode.com\\\/blog\\\/2011\\\/11\\\/backup-your-mac-to-remote-server\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/diyode.com\\\/blog\\\/2011\\\/11\\\/backup-your-mac-to-remote-server\\\/\",\"url\":\"https:\\\/\\\/diyode.com\\\/blog\\\/2011\\\/11\\\/backup-your-mac-to-remote-server\\\/\",\"name\":\"Backup your Mac to remote server - DIYode Community Workshop\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/diyode.com\\\/blog\\\/#website\"},\"datePublished\":\"2011-11-16T01:53:00+00:00\",\"dateModified\":\"2011-11-28T23:03:02+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/diyode.com\\\/blog\\\/2011\\\/11\\\/backup-your-mac-to-remote-server\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/diyode.com\\\/blog\\\/2011\\\/11\\\/backup-your-mac-to-remote-server\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/diyode.com\\\/blog\\\/2011\\\/11\\\/backup-your-mac-to-remote-server\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/diyode.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Backup your Mac to remote server\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/diyode.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/diyode.com\\\/blog\\\/\",\"name\":\"DIYode Community Workshop\",\"description\":\"Make \u2022 Share \u2022 Play\",\"publisher\":{\"@id\":\"https:\\\/\\\/diyode.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/diyode.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/diyode.com\\\/blog\\\/#organization\",\"name\":\"DIYode Community Workshop\",\"url\":\"https:\\\/\\\/diyode.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/diyode.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/diyode.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/diyodeLogo.png\",\"contentUrl\":\"https:\\\/\\\/diyode.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/diyodeLogo.png\",\"width\":238,\"height\":130,\"caption\":\"DIYode Community Workshop\"},\"image\":{\"@id\":\"https:\\\/\\\/diyode.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/diyode.com\\\/blog\\\/#\\\/schema\\\/person\\\/e77b70fd76b8b623d4abc68c53250bc3\",\"name\":\"Mark Zander\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/275b2afa8a9544f6d2fb052fd0c1ec6a7cbd001d6027f354a88bb1ab6f058bd0?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/275b2afa8a9544f6d2fb052fd0c1ec6a7cbd001d6027f354a88bb1ab6f058bd0?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/275b2afa8a9544f6d2fb052fd0c1ec6a7cbd001d6027f354a88bb1ab6f058bd0?s=96&d=mm&r=g\",\"caption\":\"Mark Zander\"},\"url\":\"https:\\\/\\\/diyode.com\\\/blog\\\/author\\\/mark-zander\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Backup your Mac to remote server - DIYode Community Workshop","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/diyode.com\/blog\/2011\/11\/backup-your-mac-to-remote-server\/","og_locale":"en_US","og_type":"article","og_title":"Backup your Mac to remote server - DIYode Community Workshop","og_description":"There are quite a few examples out there in how to use rsync to duplicate how Timemachine does its backups. This is the article which first inspired me. http:\/\/blog.interlinked.org\/tutorials\/rsync_time_machine.html But I still had some problems with it. Firstly you either had to pull the backup from the Mac. My Mac is not on all the [&hellip;]","og_url":"https:\/\/diyode.com\/blog\/2011\/11\/backup-your-mac-to-remote-server\/","og_site_name":"DIYode Community Workshop","article_published_time":"2011-11-16T01:53:00+00:00","article_modified_time":"2011-11-28T23:03:02+00:00","author":"Mark Zander","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Mark Zander","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/diyode.com\/blog\/2011\/11\/backup-your-mac-to-remote-server\/#article","isPartOf":{"@id":"https:\/\/diyode.com\/blog\/2011\/11\/backup-your-mac-to-remote-server\/"},"author":{"name":"Mark Zander","@id":"https:\/\/diyode.com\/blog\/#\/schema\/person\/e77b70fd76b8b623d4abc68c53250bc3"},"headline":"Backup your Mac to remote server","datePublished":"2011-11-16T01:53:00+00:00","dateModified":"2011-11-28T23:03:02+00:00","mainEntityOfPage":{"@id":"https:\/\/diyode.com\/blog\/2011\/11\/backup-your-mac-to-remote-server\/"},"wordCount":577,"commentCount":0,"publisher":{"@id":"https:\/\/diyode.com\/blog\/#organization"},"keywords":["linux","mac","rsync","samba","time machine"],"articleSection":["Computers"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/diyode.com\/blog\/2011\/11\/backup-your-mac-to-remote-server\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/diyode.com\/blog\/2011\/11\/backup-your-mac-to-remote-server\/","url":"https:\/\/diyode.com\/blog\/2011\/11\/backup-your-mac-to-remote-server\/","name":"Backup your Mac to remote server - DIYode Community Workshop","isPartOf":{"@id":"https:\/\/diyode.com\/blog\/#website"},"datePublished":"2011-11-16T01:53:00+00:00","dateModified":"2011-11-28T23:03:02+00:00","breadcrumb":{"@id":"https:\/\/diyode.com\/blog\/2011\/11\/backup-your-mac-to-remote-server\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/diyode.com\/blog\/2011\/11\/backup-your-mac-to-remote-server\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/diyode.com\/blog\/2011\/11\/backup-your-mac-to-remote-server\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/diyode.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Backup your Mac to remote server"}]},{"@type":"WebSite","@id":"https:\/\/diyode.com\/blog\/#website","url":"https:\/\/diyode.com\/blog\/","name":"DIYode Community Workshop","description":"Make \u2022 Share \u2022 Play","publisher":{"@id":"https:\/\/diyode.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/diyode.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/diyode.com\/blog\/#organization","name":"DIYode Community Workshop","url":"https:\/\/diyode.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/diyode.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/diyode.com\/blog\/wp-content\/uploads\/2024\/09\/diyodeLogo.png","contentUrl":"https:\/\/diyode.com\/blog\/wp-content\/uploads\/2024\/09\/diyodeLogo.png","width":238,"height":130,"caption":"DIYode Community Workshop"},"image":{"@id":"https:\/\/diyode.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/diyode.com\/blog\/#\/schema\/person\/e77b70fd76b8b623d4abc68c53250bc3","name":"Mark Zander","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/275b2afa8a9544f6d2fb052fd0c1ec6a7cbd001d6027f354a88bb1ab6f058bd0?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/275b2afa8a9544f6d2fb052fd0c1ec6a7cbd001d6027f354a88bb1ab6f058bd0?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/275b2afa8a9544f6d2fb052fd0c1ec6a7cbd001d6027f354a88bb1ab6f058bd0?s=96&d=mm&r=g","caption":"Mark Zander"},"url":"https:\/\/diyode.com\/blog\/author\/mark-zander\/"}]}},"_links":{"self":[{"href":"https:\/\/diyode.com\/blog\/wp-json\/wp\/v2\/posts\/440","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/diyode.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/diyode.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/diyode.com\/blog\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/diyode.com\/blog\/wp-json\/wp\/v2\/comments?post=440"}],"version-history":[{"count":7,"href":"https:\/\/diyode.com\/blog\/wp-json\/wp\/v2\/posts\/440\/revisions"}],"predecessor-version":[{"id":444,"href":"https:\/\/diyode.com\/blog\/wp-json\/wp\/v2\/posts\/440\/revisions\/444"}],"wp:attachment":[{"href":"https:\/\/diyode.com\/blog\/wp-json\/wp\/v2\/media?parent=440"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/diyode.com\/blog\/wp-json\/wp\/v2\/categories?post=440"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/diyode.com\/blog\/wp-json\/wp\/v2\/tags?post=440"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}