User Tools

Site Tools


timemachine

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
timemachine [2013/05/12 20:46]
rdibley
timemachine [2015/03/30 06:18] (current)
adamess [Netatalk] clarify that volsizelimit is given in MiB
Line 1: Line 1:
 ====== Time Capsule on OpenWRT (Apple File Protocol Server with Time Machine Support) ====== ====== Time Capsule on OpenWRT (Apple File Protocol Server with Time Machine Support) ======
 +
 +
 +====== Working fine with '​force'​ mount option in fstab ======
 +
 +
  
 ===== Intro ===== ===== Intro =====
Line 49: Line 54:
   * **block-mount:​** Scripts for automatically mounting the drive on boot or when plugged in.   * **block-mount:​** Scripts for automatically mounting the drive on boot or when plugged in.
  
-Plug in the external drive and find the device number using the **//blkid//** command:+Plug in the external drive and find the device number using the **//block info//** command ​(on older installations of OpenWRT you may have to use the command **//​blkid//​** instead):
  
 <​code>​ <​code>​
-root@OpenWRT:~# blkid +root@OpenWrt:~# block info 
-/dev/mtdblock3: TYPE="​squashfs"​  +/dev/mtdblock2UUID="​1e0c82a7-150c1d32-b3d5c71c-917a14ed"​ VERSION="​4.0" ​TYPE="​squashfs"​ 
-/dev/sda1LABEL="​EFI"​ UUID="​70D6-1701" ​TYPE="vfat"  +/dev/mtdblock3: TYPE="jffs2
-/​dev/​sda2: ​UUID="​b8212b1d-8d11-30e7-9506-eca9ac887034"​ LABEL="​TimeMachine" ​TYPE="​hfsplus"​  +/dev/sda2: TYPE="​hfsplus"​ 
-root@OpenWRT:~#+root@OpenWrt:~# 
 </​code>​ </​code>​
  
-Configure the drive to be automounted on startup or when plugged in.  Add the following to **/​etc/​config/​fstab**,​ where ///​dev/​sda2//​ is the drive identified using **//blkid//**:+Configure the drive to be automounted on startup or when plugged in.  Add the following to **/​etc/​config/​fstab**,​ where ///​dev/​sda2//​ is the drive identified using **//block info//**:
  
 <​code>​ <​code>​
Line 66: Line 71:
  option device ​  /​dev/​sda2  option device ​  /​dev/​sda2
  option fstype ​  ​hfsplus  option fstype ​  ​hfsplus
- option options ​ rw,sync+ option options  ​force,rw,sync
  option enabled ​ 1  option enabled ​ 1
  option enabled_fsck 0  option enabled_fsck 0
Line 84: Line 89:
 chown -R root:​timemachine /​mnt/​TimeMachine chown -R root:​timemachine /​mnt/​TimeMachine
 </​code>​ </​code>​
- 
 ===== Netatalk ===== ===== Netatalk =====
  
-Netatalk is the linux package that supports the Apple File Protocol on linux systems, allowing for file serving, printing, and time servers. ​ It can also be configured to support Time Machine over a network, replicating the features of Apple'​s Time Capsule. ​ Starting with version 2.2, Netatalk supports the latest AFP protocol level 3.3, required to support Time Machine on OSX 10.7 (Lion) and above. ​ Thankfully, netatalk 2.2.1-5 is included in Attitude Adjustment. ​ For the purposes of this installation,​ only a Time Machine share will be configured. ​ Start by installing the **//​netatalk//​** package:+Netatalk is the linux package that supports the Apple File Protocol on linux systems, allowing for file serving, printing, and time servers. ​ It can also be configured to support Time Machine over a network, replicating the features of Apple'​s Time Capsule. ​ Starting with version 2.2, Netatalk supports the latest AFP protocol level 3.3, required to support Time Machine on OSX 10.7 (Lion) and above. Thankfully, netatalk 2.2.1-5 is included in Attitude Adjustment. ​If you are using Barrier Breaker, note that netatalk was removed from this version, so you will need to grab an old package from Attitude Adjustment 
 + 
 +For the purposes of this installation,​ only a Time Machine share will be configured. ​ Start by installing the **//​netatalk//​** package:
  
 <​code>​ <​code>​
 opkg install netatalk opkg install netatalk
 +</​code>​
 +
 +**If this command fails,** grab the old version of this package from Attitude Adjustment (you will need to change the //ar71xx// part of the URL to match the architecture of your router):
 +
 +<​code>​
 +opkg install http://​downloads.openwrt.org/​attitude_adjustment/​12.09/​ar71xx/​generic/​packages/​netatalk_2.2.1-5_ar71xx.ipk
 +cd /usr/lib
 +ln -s libgcrypt.so.20 libgcrypt.so.11
 </​code>​ </​code>​
  
Line 105: Line 119:
 </​code>​ </​code>​
  
-The first parameter specifies the location of the shared volume, while the second specifies the name.  The Time Machine uses a CNID database to reference files on the shared volume. ​ By default, this database will be located in the root directory of the shared volume. ​ The size of the shared volume reported to time machine is set using the **//volsizlimit//** parameter. ​ Set this parameter to less than the full size of the disk to reserve space for the database. ​ (If the database can't be written to or is corrupted, the entire Time Machine repository may be lost)  The **//​allow//​** and **//​rwlist//​** parameters specify which users can access and write to the time machine. ​ Either specify a user name directly, or just use **//​@timemachine//​** to allow access for users in the **//​timemachine//​** group. ​ Reference the [[http://​linux.die.net/​man/​5/​applevolumes.default|AppleVolumes.default]] man page for further information on options.+The first parameter specifies the location of the shared volume, while the second specifies the name.  The Time Machine uses a CNID database to reference files on the shared volume. ​ By default, this database will be located in the root directory of the shared volume. ​ The size of the shared volume reported to time machine is set using the **//volsizelimit//** parameter. ​The size is given in MiB. Set this parameter to less than the full size of the disk to reserve space for the database. (If the database can't be written to or is corrupted, the entire Time Machine repository may be lost)  The **//​allow//​** and **//​rwlist//​** parameters specify which users can access and write to the time machine. ​ Either specify a user name directly, or just use **//​@timemachine//​** to allow access for users in the **//​timemachine//​** group. ​ Reference the [[http://​linux.die.net/​man/​5/​applevolumes.default|AppleVolumes.default]] man page for further information on options.
  
 Restart netatalk and enable on boot: Restart netatalk and enable on boot:
Line 114: Line 128:
 /​etc/​init.d/​afpd enable /​etc/​init.d/​afpd enable
 </​code>​ </​code>​
- 
 ===== Avahi ===== ===== Avahi =====
  
Line 123: Line 136:
 </​code>​ </​code>​
  
-Avahi is configured via **/​etc/​avahi/​avahi-daemon.conf**,​ see [[http://​linux.die.net/​man/​5/​avahi-daemon.conf]]. ​ Only two lines of the default file need changing:+Avahi is configured via **/​etc/​avahi/​avahi-daemon.conf**,​ see [[http://​linux.die.net/​man/​5/​avahi-daemon.conf]]. ​ Only three lines of the default file need changing:
  
 <​code>​ <​code>​
 host-name=TimeMachine host-name=TimeMachine
 enable-dbus=no enable-dbus=no
 +allow-interfaces=br-lan
 </​code>​ </​code>​
  
Line 199: Line 213:
 ===== Recovery from Disk Errors ===== ===== Recovery from Disk Errors =====
  
-FIXME If the backup process is interrupted,​ the database can become corrupt and unusable. ​ Time Machine will report that the backup is unusable and will suggest creating a new backup.  ​Need to add a section to cover how to properly set up the time capsule so that it automatically and robustly recovers from these errors.+If the backup process is interrupted,​ the database can become corrupt and unusable. ​ Time Machine will report that the backup is unusable and will suggest creating a new backup. 
 + 
 +Use the following steps on your Mac as root: 
 +  - Connect ​to the TimeMachine network share. 
 +  - Run ''/​usr/​bin/​chflags -R nouchg "/​Volumes/​TimeMachine/​[hostname].sparsebundle"''​ 
 +  - Run ''/​usr/​bin/​hdiutil attach -nomount -noverify -noautofsck "/​Volumes/​TimeMachine/​[hostname].sparsebundle"''​ 
 +  - ''/​sbin/​fsck_hfs -drfy /​dev/​disk3s2''​ # or whatever disk partition ​it is mounted as 
 +  - Run ''/​usr/​bin/​sed -i ""​ -e'​s/<​integer>​2<​\/​integer>/<​integer>​0<​\/​integer>'​ /​Volumes/​TimeMachine/​[hostname].sparsebundle/​com.apple.TimeMachine.MachineID.plist''​ 
 +  - ''​diskutil eject "/​Volumes/​TimeMachine/​[hostname].sparsebundle"''​ 
 +  - Try running your backup again.
timemachine.1368384365.txt.bz2 · Last modified: 2013/05/12 20:46 by rdibley