I'm new to NAS4Free and to this forum so bear with me.
This post may likely be moved to a more appropriate place like AFP, Backup or the How-to section.
In the last few days I struggled to get NAS4Free being accepted as a time machine backup target by OS X 10.8.x. Marking an AFP share as a Time Machine drive didn't work reliable for me. Either the drive didn't show up or other shares vanished after AFP restart. Renaming the time machine share sometimes caused it to pop up again or not.
Trying
Code: Select all
dns-sd -Z _adisk localChecking on the NAS using
Code: Select all
cat /var/etc/mdnsresponder.confThe following how-to describes all the steps necessary to use NAS4Free as a time machine backup target. As a bonus you can restrict the size of your Time Machine backup so it doesn't entirely fill up your disk.
Prepare user and group
We use a special user for Time Machine backups so the backup is nicely separated from the other data on the disks.
- Log in to your NAS using the web gui
- create a new group timemachine
- Create a user timemachine
- Make timemachine the default group for the timemachine user
Prepare Time Machine directory
The following is best done on the console or over ssh. Log in as root. It is assumed your disk is called data in the examples.
Create a directory on your data disk named TMBackup (or whatever you like):
Code: Select all
mkdir /mnt/data/TMBackupCode: Select all
chown timemachine:timemachine /mnt/data/TMBackupCode: Select all
chmod 1775 /mnt/data/TMBackupCreate the Time Machine share
AFP shares are announced using Bonjour (Apples name for zeroconf) by NAS4Free when Automatic disk discovery is marked on the shares details page.
Don't let NAS4Free announce your Time Machine shares!
In fact don't tell NAS4Free anything about the Time Machine directory. We will use another means to publish the share.
Go to the users and groups page of the gui and add the directory /mnt/data/TMBackup/ as the home directory for user timemachine we created earlier.
Create the file /mnt/data/TMBackup/AppleVolumes with the following contents:
Code: Select all
"/mnt/data/TMBackup/" "Time Machine" volcharset:UTF8 options:usedots,upriv,tm volsizelimit:800000
Code: Select all
chown :timemachine /mnt/data/TMBackup/AppleVolumesNote options:usedots,upriv,tm which tells the AFP daemon that this share is a Time Machine target.
Using volsizelimit:800000 we restrict the size of the backup to 800GB. Chose whatever is suitable for you.
Announcing the Time Machine target using Bonjour
Up to now the new share Time Machine is not visible in Time Machine on the client. This will change now.
Create the file /mnt/data/TMBackup/tm_mdnsresponder.conf with the following contents:
Code: Select all
Rewind Time
_device-info._tcp. local.
1
model=AirPort
Rewind Time
_adisk._tcp. local.
9
sys=waMA=0
dk0=adVF=0xa1,adVN=Time Machine
Change group:
Code: Select all
chown :timemachine /mnt/data/TMBackup/tm_mdnsresponder.confCode: Select all
#! /bin/bash
#kill all running mDNSResponderPosix instances
killall -INT mDNSResponderPosix
#Start new ones. Make sure our time machine announce is the first to be launched
/usr/local/bin/mDNSResponderPosix -b -f /mnt/data/TMBackup/tm_mdnsresponder.conf
/usr/local/bin/mDNSResponderPosix -b -f /var/etc/mdnsresponder.conf
Code: Select all
chown :timemachine /mnt/data/TMBackup/addtmdisk.shCode: Select all
chmod 774 /mnt/data/TMBackup/addtmdisk.shCreate a new postinit script with command:
Code: Select all
/mnt/data/TMBackup/addtmdisk.sh Code: Select all
killall -INT mDNSResponderPosix ; rm /var/run/mDNSResponder.pidReboot your NAS.
Select your share in TM preferences on the client
After your NAS rebooted you should see two devices in the Shared section of your Finder sidebar:
- Your NAS server with a nice XServe icon as before
- A new device named Rewind Time
backup target. After selection a login window pops up for the share Time Machine. Login as user timemachine (the
one you created in the beginning).
OS X stores the login credentials in your system keychain. You don't have to reenter them on each backup.
Roundup
This setup works for me for some days now. Each hour the share is mounted and a backup performed. Shutting down the
NAS in between is no problem.
Being logged in to the NAS with your normal user login is possible while Time Machine works in the background on your
backup.
You may skip the following if you don't care about the technical background.
What do these scripts and commands do?
File tm_mdnsresponder.conf
This is the configuration file for the additional mDNSResponderPosix daemon we start in the addtmdisks.dh script.
- The first section tells the OS X clients that a new device is around.
This causes the Rewind Time device to show up in the sidebar with it's own icon. You may chose a name to your liking here. The line model=AirPort tells OS X which icon to show in the sidebar. According to [1] you may use one of the following:
Code: Select all
Rewind Time _device-info._tcp. local. 1 model=AirPort
- RackMac (same as Xserve)
- PowerBook
- PowerMac
- Macmini
- iMac
- MacBook
- MacBookPro
- MacBookAir
- MacPro
- AppleTV1,1
- AirPort
- The second section announces the share.
Use the same name as in the first section so in the Time Machine preferences you can see that this share is on device Rewind Time.
Code: Select all
Rewind Time _adisk._tcp. local. 9 sys=waMA=0 dk0=adVF=0xa1,adVN=Time Machine
More will be added later...
Here are some links you may find interesting wrt Time Machine and non Apple blessed hardware:
[1] http://kremalicious.com/ubuntu-as-mac-f ... ne-volume/
[2] http://the.taoofmac.com/space/HOWTO/Setup/Rendezvous
[3] https://developer.apple.com/library/mac ... ments.html
Edits
24.11.2012: Typo and formatting corrections. Added some technical explanation.







