{"id":158,"date":"2015-04-27T22:06:16","date_gmt":"2015-04-27T20:06:16","guid":{"rendered":"http:\/\/www.ritter.cc\/?page_id=158"},"modified":"2015-04-27T22:06:16","modified_gmt":"2015-04-27T20:06:16","slug":"raspberry-als-mac-timemachine","status":"publish","type":"page","link":"https:\/\/www.ritter.cc\/?page_id=158","title":{"rendered":"Raspberry als Mac TimeMachine"},"content":{"rendered":"<p>In der folgenden Anleitung wird davon ausgegangen, dass der Raspberry Pi in der Grundkonfiguration fertig eingerichtet und ins Netzwerk eingebunden ist. Anleitungen dazu gibt es zuhauf.<\/p>\n<div id=\"x-content-band-3\" class=\"x-content-band vc man\">\n<div class=\"x-container wpb_row\">\n<div class=\"x-column x-sm vc x-1-1\">\n<h3>Festplatte vorbereiten<\/h3>\n<p>Es empfiehlt sich, eine externe Festplatte mit separatem Netzteil zu verwenden. Viele Probleme entstehen dadurch, dass die USB-Anschl\u00fcsse des Raspberry Pi nicht gen\u00fcgend Strom liefern k\u00f6nnen.<\/p>\n<p>&nbsp;<\/p>\n<p>Auch bei mir war es so, mit einer 2,5&#8243; WD 2TB HDD (USB3)<br \/>\nDa die Platte nicht am Pi verf\u00fcgbar war stellte sich heraus, das das Stromlimit am Pi auf maximal 600mA im default Fall eingestellt war.<\/p>\n<p>Abhilfe schafft die Abschaltung des Limits mit :<\/p>\n<p>The first way is via a new option in \/boot\/config.txt. Currently you can add:<\/p>\n<pre>max_usb_current=1<\/pre>\n<p>&nbsp;<\/p>\n<p>Die Festplatte muss am Mac mit dem Festplattendienstprogramm partitioniert werden und mit dem MacOS Extended (journaled) Dateisystem formatiert werden. Anschlie\u00dfend die Platte an den Raspberry Pi anschlie\u00dfen und per\u00a0<code>ssh<\/code>\u00a0auf dem Raspberry Pi einloggen.<br \/>\nEin Problem stellte sich jedoch dadurch heraus, das die hfsutils eine &#8220;journaled&#8221; Platte nicht als Read\/Write mounten kann. Dies klappt dann nur im Read Only mode. Abhilfe schafft hierzu, das Journaling f\u00fcr die entsprechende Partition am Mac zu deaktivieren.<\/p>\n<p>HFS+ Unterst\u00fctzung installieren:<\/p>\n<pre class=\"x-code\"><code>sudo apt-get install hfsplus hfsutils hfsprogs<\/code><\/pre>\n<p>Mountpoint\u00a0<code>\/media\/TimeCapsule<\/code>\u00a0erstellen und mit den entsprechenden Rechten versehen:<\/p>\n<pre class=\"x-code\"><code>sudo mkdir \/media\/TimeCapsule\r\nsudo chown pi:pi \/media\/TimeCapsule\r\nsudo chmod 777 \/media\/TimeCapsule<\/code><\/pre>\n<p>Jetzt m\u00fcssen wir herausfinden, mit welchem Device die Platte ins System eingebunden ist:<\/p>\n<pre class=\"x-code\"><code>sudo blkid<\/code><\/pre>\n<p>Dies liefert eine Liste aller aktuell angeschlossenen Platten. Wichtig ist der Eintrag mit\u00a0<code>TYPE=\"hfsplus\"<\/code>. Bei mir sieht das z.B. so aus:<\/p>\n<pre class=\"x-code\"><code>pi@raspberrypi ~ $ sudo blkid\r\n\/dev\/mmcblk0p1: SEC_TYPE=\"msdos\" UUID=\"C522-EA52\" TYPE=\"vfat\"\r\n\/dev\/mmcblk0p2: UUID=\"62ba9ec9-47d9-4421-aaee-71dd6c0f3707\" TYPE=\"ext4\"\r\n\/dev\/sda1: LABEL=\"EFI\" UUID=\"67E3-17ED\" TYPE=\"vfat\"\r\n\/dev\/sda2: UUID=\"5d70a32f-9437-3e79-90e5-b094bde9c67c\" LABEL=\"TimeMachine\" TYPE=\"hfsplus\"<\/code><\/pre>\n<p>Hier erkennt man, dass die Backup-Partition als\u00a0<code>\/dev\/sda2<\/code>\u00a0eingebunden ist. Jetzt kann die Platte zun\u00e4chst mal manuell gemountet werden:<\/p>\n<pre class=\"x-code\"><code>sudo mount -t hfsplus -o force \/dev\/sda2 \/media\/TimeCapsule\/<\/code><\/pre>\n<p>Ein\u00a0<code>ls -l \/media\/TimeCapsule<\/code>\u00a0sollte jetzt einige Dateien und Verzeichnisse auflisten.<\/p>\n<p>Bei meinen Versuchen hatte ich keine Schreibrechte vom Mac, die L\u00f6sung brachte ein nochmaliges Setzen der Rechte bei gemounteter Platte:<\/p>\n<pre class=\"x-code\"><code>sudo chmod 777 \/media\/TimeCapsule<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<div id=\"x-content-band-4\" class=\"x-content-band vc man\">\n<h3>TimeCapsule Server im Netzwerk<\/h3>\n<p>Um den Raspberry Pi mit der Festplatte als TimeCapsule Server sichtbar zu machen, muss noch etwas Software installiert werden.<\/p>\n<h4>Avahi<\/h4>\n<pre>sudo apt-get install avahi-daemon libavahi-client-dev libdb5.3-dev db-util db5.3-util libgcrypt11 libgcrypt11-dev\r\n\r\nAls n\u00e4chstes ben\u00f6tigen wir Netattalk....\r\nIn den Raspberry Repos ist lediglich Version 2 ohne Spotlight Unterst\u00fctzung vorhanden.\r\nAlso Version 3 von Github herunterladen und selbst kompilieren...\r\n\r\n<\/pre>\n<h1>Raspberry Pi: Install Netatalk 3 with Spotlight support<\/h1>\n<p>I recently upgraded from Netatalk 2.2 to Netatalk 3.1 on my Raspberry Pi. Since Netatalk 3 isn\u2019t in the repositories, I built it from source. Netatalk 3 also allows for Spotlight searching on network volumes.<\/p>\n<h2>Backup configuration files<\/h2>\n<p>Netatalk 3 uses a different arrangement of configuration files, but I backed up my current ones for reference:<\/p>\n<p class=\"code\">cp -R \/etc\/netatalk\/ ~\/confbackup<\/p>\n<h2>Remove Netatalk 2<\/h2>\n<p>Start by uninstalling netatalk 2:<\/p>\n<p class=\"code\">sudo apt-get remove netatalk<\/p>\n<h2>Install Dependencies<\/h2>\n<p>This is a somewhat exhaustive list (you probably have most of these installed already):<\/p>\n<p class=\"code\">sudo apt-get install avahi-daemon bison build-essential checkinstall cracklib-runtime db-util db5.1-util groff libacl1 libacl1-dev libattr1 libavahi-client-dev libavahi-client3 libavahi-common3 libc6 libcomerr2 libcrack2 libcrack2-dev libcups2 libdb-dev libdb5.1 libdbus-1-dev libdbus-glib-1-dev libevent-dev libgcc1 libgcrypt11-dev libgcrypt11 libglib2.0-dev libgnutls26 libgssapi-krb5-2 libk5crypto3 libkrb5-3 libkrb5-dev libldap-2.4-2 libldap2-dev libpam-cracklib libpam-modules libpam0g libpam0g-dev libssl-dev libtool libtracker-extract-0.14-0 libtracker-extract-0.14-dev libtracker-miner-0.14-0 libtracker-miner-0.14-dev libtracker-sparql-0.14-0 libtracker-sparql-0.14-dev libwrap0 libwrap0-dev lsof netbase perl procps quota rc systemtap-sdt-dev tracker tracker-explorer tracker-extract tracker-gui tracker-miner-fs tracker-utils zlib1g<\/p>\n<h2>Download and unpack Netatalk 3 source<\/h2>\n<p>Go to\u00a0<a href=\"http:\/\/netatalk.sourceforge.net\/\">the Netatalk homepage<\/a>\u00a0and download the latest source code. For me this was 3.1.6. Once downloaded, unpack it, e.g.<\/p>\n<p class=\"code\">tar -xf netatalk-3.1.6.tar.bz2<\/p>\n<p class=\"code\">cd netatalk-3.1.6<\/p>\n<h2>Configure and build Netatalk<\/h2>\n<p>You\u2019ll need to specify the version of Gnome Tracker (Spotlight backend) that you\u2019ve installed. The version in the repositories is 0.14, so the configure line looks like this:<\/p>\n<p class=\"code\">.\/configure &#8211;with-init-style=debian-sysv &#8211;with-tracker-pkgconfig-version=0.14<\/p>\n<p>If it configures successfully, then<\/p>\n<p class=\"code\">make<\/p>\n<p class=\"code\">sudo make install<\/p>\n<p>In my case the build failed when building the Spotlight support. I hadn\u2019t installed bison before starting and rather than fail during configure, netatalk failed to build. I ended up installing bison from source as well, though I expect the version in the repositories will work fine too.<\/p>\n<h2>Configure Netatalk 3<\/h2>\n<p>The new configuration file (only one) is \/usr\/local\/etc\/afp.conf. Mine looks like this:<\/p>\n<p class=\"code\">[Global]<br \/>\nhostname = raspberrypi<br \/>\nzeroconf = yes<br \/>\nlog file = \/var\/log\/netatalk.log<br \/>\ncnid scheme = dbd<br \/>\nuam list = uams_dhx2.so<br \/>\nsave password = yes<br \/>\nspotlight = yes<br \/>\ndbus daemon = \/usr\/bin\/dbus-daemon<\/p>\n<p>[Homes]<br \/>\nbasedir regex = \/home<\/p>\n<p>[Time Machine]<br \/>\npath = \/media\/backup\/Backups\/TimeMachine<br \/>\ntime machine = yes<\/p>\n<p>Important lines are the \u2018spotlight = yes\u2019 to enable Spotlight indexing, and the \u2018dbus daemon\u2019 line which needs an accurate path to the dbus-daemon command in order to connect to the indexer. More information can be found on\u00a0<a href=\"http:\/\/netatalk.sourceforge.net\/3.0\/htmldocs\/afp.conf.5.html\">the Netatalk website<\/a>.<\/p>\n<p>Die Zeile\u00a0<code>hostname = TimeCapsule Pi<\/code>\u00a0legt fest, unter welchem Namen der Server sp\u00e4ter auf dem Mac unter\u00a0<em>Freigaben<\/em>\u00a0auftauchen wird. Der Eintrag in eckigen Klammern\u00a0<code>[TimeMachine]<\/code>\u00a0ist der Name, unter dem das Backup-Volume in den Systemeinstellungen von\u00a0<em>TimeMachine<\/em>\u00a0aufgelistet wird. Wer hier noch weitere Optionen oder Anpassungen vornehmen will, kann in der\u00a0<a href=\"http:\/\/netatalk.sourceforge.net\/3.0\/htmldocs\/\" target=\"_blank\">Dokumentation zu netatalk<\/a>\u00a0nachlesen.<\/p>\n<p>Die Datei\u00a0<code>\/etc\/avahi\/services\/timecapsule_afpd.service<\/code>\u00a0so editieren\u2026:<\/p>\n<pre>sudo nano \/etc\/avahi\/services\/timecapsule_afpd.service<\/pre>\n<p>\u2026dass sie folgenden Inhalt hat:<\/p>\n<pre>&lt;?xml version=\"1.0\" standalone='no'?&gt;\r\n&lt;!DOCTYPE service-group SYSTEM \"avahi-service.dtd\"&gt;\r\n&lt;service-group&gt;\r\n&lt;\/service-group&gt;<\/pre>\n<h4>Startscript<\/h4>\n<p>Damit die Services nach einem Neustart des Raspberry Pi automatisch gestartet werden, fehlt jetzt noch ein Startscript, das wir mit<\/p>\n<pre>sudo nano \/etc\/init.d\/TimeCapsule<\/pre>\n<p>anlegen. Das Script mit folgendem Inhalt f\u00fcllen:<\/p>\n<pre>#!\/bin\/bash\r\nif [ \"$(id -u)\" != \"0\" ]; then\r\n\techo \"This script must be run as root\" 1&gt;&amp;2\r\n\texit 1\r\nfi\r\ncase \"$1\" in\r\n\tstart)\r\n\t\tservice netatalk stop\r\n\t\tservice avahi-daemon stop\r\n\t\tumount -l \/media\/TimeCapsule\r\n\t\tmount -t hfsplus -o force \/dev\/sda2 \/media\/TimeCapsule\/\r\n\t\tservice netatalk start\r\n\t\tservice avahi-daemon start\r\n\t;;\r\n\tstop)\r\n\t\tservice netatalk stop\r\n\t\tservice avahi-daemon stop\r\n\t\tumount -l \/media\/TimeCapsule\r\n\t;;\r\n\t*)\r\n\t\techo \"Usage: \/etc\/init.d\/TimeCapsule {start|stop}\"\r\n\t\texit 1\r\n\t;;\r\nesac\r\nexit 0<\/pre>\n<p>Wichtig:\u00a0Das device\u00a0<code>\/dev\/sda2<\/code>\u00a0muss durch das passende device, das zuvor oben mit\u00a0<code>sudo blkid<\/code>\u00a0ermittelt wurde, ersetzt werden.<\/p>\n<p>Jetzt das Script ausf\u00fchrbar machen, in die automatischen Startscripte einpflegen und anschlie\u00dfend einmal manuell starten:<\/p>\n<pre>sudo chmod 755 \/etc\/init.d\/TimeCapsule\r\nsudo update-rc.d TimeCapsule defaults\r\nsudo \/etc\/init.d\/TimeCapsule start<\/pre>\n<p>Damit sind wir auf dem Raspberry Pi fertig. Das Backup-Volume sollte jetzt unter dem Namen\u00a0<em>TimeCapsule Pi<\/em>\u00a0auf dem Mac unter\u00a0<em>Freigaben<\/em>\u00a0auftauchen:<\/p>\n<div id=\"x-content-band-6\" class=\"x-content-band vc man\">\n<div class=\"x-container wpb_row\">\n<div class=\"x-column x-sm vc x-1-1\">\n<h3>TimeMachine auf dem Mac konfigurieren<\/h3>\n<p>Auf dem Mac w\u00e4hlen wir jetzt in den Systemeinstellungen f\u00fcr\u00a0<em>TimeMachine<\/em>\u00a0den Raspberry Pi als Backup Volume aus. Bei der Frage nach den Anmeldeinformationen w\u00e4hlen wir\u00a0<em>als Gast anmelden<\/em>. Anschlie\u00dfend kann das Backup gestartet werden.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div id=\"x-content-band-7\" class=\"x-content-band vc man\">\n<div class=\"x-container wpb_row\">\n<div class=\"x-column x-sm vc x-1-1\"><img decoding=\"async\" class=\"x-img x-img-none none\" src=\"http:\/\/zisoft.de\/wp-content\/uploads\/2015\/02\/TimeMachine1.png\" alt=\"\" \/><\/div>\n<\/div>\n<\/div>\n<pre>\r\n\r\n<\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In der folgenden Anleitung wird davon ausgegangen, dass der Raspberry Pi in der Grundkonfiguration fertig eingerichtet und ins Netzwerk eingebunden<\/p>\n<p><a href=\"https:\/\/www.ritter.cc\/?page_id=158\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\">Raspberry als Mac TimeMachine<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":112,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"ngg_post_thumbnail":0,"footnotes":""},"class_list":["post-158","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.ritter.cc\/index.php?rest_route=\/wp\/v2\/pages\/158","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ritter.cc\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.ritter.cc\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.ritter.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ritter.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=158"}],"version-history":[{"count":1,"href":"https:\/\/www.ritter.cc\/index.php?rest_route=\/wp\/v2\/pages\/158\/revisions"}],"predecessor-version":[{"id":159,"href":"https:\/\/www.ritter.cc\/index.php?rest_route=\/wp\/v2\/pages\/158\/revisions\/159"}],"up":[{"embeddable":true,"href":"https:\/\/www.ritter.cc\/index.php?rest_route=\/wp\/v2\/pages\/112"}],"wp:attachment":[{"href":"https:\/\/www.ritter.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}