OS X: Time Machine backup to Synology DS107+
I finally got the single-bay, 1TB NAS:
It took a few hours to “make” OS X TimeMachine to accept the NAS and perform backups – the steps below will outline what is necessary.
Update 2009-05-14: With 10.5.7 Apple seems to have broken the sparse-band-size, resulting in the current sparsebundle to be unmountable. Apple has reduced the band-sizes of sparse-bundles to 128MB. You can convert your existing sparsebundle via the following command:
hdiutil convert -format UDSB -imagekey sparse-band-size=262144 -o new.sparsebundle old.sparsebundle
Update 2009-02-11: I have received a number of reports that large sparse-bundles (in excess of 250 gigabytes) fail to backup properly. User joar on the Synology forum has the explanation for this: “Those sparsebundle images that Time Machine uses work like this: They basically consist of a few files and one folder with all the payload files (called “bands”) in it. If the images are created automatically by Time Machine, the size of each “band” file is set to 8MB. If your backup is > 300GB you can do the math. Remember what I wrote? One folder with all the bands.”
To solve this problem instead of creating 8MB bands we will create 128MB bands (262144 times 512 bytes). You are able to convert your existing sparse-bundles via (change the max-size from 70GB to whatever suits you):
hdiutil convert -format UDSB -tgtimagekey sparse-band-size=262144 -tgtimagekey size=70g -o tempfilename.sparsebundle machinename_macid.sparsebundle
I tried the conversion of the above and it took extremely long – I eventually wiped my old backups and started from fresh. You will notice as part of this exercise that your original sparse-bundle image will be larger (in my case increasing the band-size increased the initial sparsebundle from 80MB to 1.5 gigabytes)
The installation was straight forward, but you should consider a number of steps:
- To be absolutely sure, prepare/initialise your new hard-drive first. As I do not have a PC, I had to get a eSata (Vantec NexStar 3) enclosure, so that I could hook up the harddrive to my MacBook Air. Once the drive is connected via USB, OS X will prompt to initialise the drive and the preparation is complete.
- After fitting the drive back into the DS107+ case, power up the device and follow the setup-assistant. I assigned a static IP-address and named the NAS MuffinStation (well, my laptop is called MacMuffin – so there)
- Disable Time Machine in your System Preferences
- Open up a terminal session and enable NAS support for Time Machine:
defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
- Time Machine saves backups in a very specific format, and we will use a sparsebundle to get this done. The sparsebundle name consists of
your computer name_mac address.sparsebundle. In my case the sparsebundle is named
- Find the MAC address of the machine’s internal Ethernet port with
ifconfig en0 | grep ether | sed s/://g | sed s/ether//in Terminal. This will return one line of output, which is the MAC address for the Ethernet port, which will be a string of letters and numbers, for example, 00:1e:c4:b8:f9:b3. Even if the network backups will be done using a different port (e.g. AirPort: usually en1), the system will use the MAC address of en0 as part of the system identifier.
- Make a new “sparsebundle” on a local disk (NOT the Time Machine disk!). This sparsebundle is a virtual filesystem image which we’ll copy to the NAS, and Time Machine will then access it remotely (that way Time Machine’s not limited by the filesystem features of whatever NAS it’s using: all the funky stuff happens within the sparsebundle). By default sparsebundles can keep growing until they fill up the NAS, but in this scenario we keep other things on the NAS as well as backups, and we’re going to limit the sparsebundle size to 70 GB.I could torture you now through Disk Utility, but there is an easier way via the command line:
sudo hdiutil create -size 70g -type SPARSEBUNDLE -nospotlight -volname "Backup of Gerd's MacBook Air" -fs "Case-sensitive Journaled HFS+" -verbose ./MagicDudeAir_001ec4b8f9b3.sparsebundle. This will create a 70GB sparse-bundle as a case-sensitive, journaled HFS+ without spotlight indexing. If your backups are large than 250 gigabytes, I suggest to use this command instead:
sudo hdiutil create -size 70g -type SPARSEBUNDLE -nospotlight -volname "Backup of Gerd's MacBook Air" -fs "Case-sensitive Journaled HFS+" -imagekey sparse-band-size=262144 -verbose ./MagicDudeAir_001ec4b8f9b3.sparsebundle
- Log into your Synology Disk-Station and create a Shared Folder. I named mine “TimeMachine”:
(Don’t make the Shared folder hidden yet)
- Create a user – I named mine “TimeMachine” and give the user R+W privileges. I also assigned my user a quota of 80GB (since this is the maximum hard-drive size on my MacBook Air):
- Optional: In another post I will show you how the Synology can broadcast your services via Bonjour, so that they immediately appear in the Finder. This is cool, since you do not have to mount your shares, but requires that your iTunes server is running on the disk-station.
- In Finder, select Go>Connect to Server. For the server address, type smb://[email protected]/timemachine. Click Connect and when prompted, enter the password and save in your keychain. It is important that you give your NAS a static IP, or use the Bonjour tip instead. Although some people prefer to mount via AFP, I chose SMB instead. I initially tried AFP and during the backup noticed the errors “
Jul 15 12:37:09 afpd: bad function 4F” being logged on the DS107+. This did not give me a high level of comfort. There seems to be no speed difference either. Through the wireless-network (G/N) I get about 6MB/sec throughput. I did find however that changing from TKIP to AES wireless-security seems to have improved the speed by 20%
- Now copy your locally created sparsebundle into the timemachine share.
- Delete the sparse-bundle on your local machine.
- Go back to the DS107+ diskstation and verify that your quota usage has increased. My empty sparsebundle used up initially 80MB, the screenshot below shows you the quota usage:
(if your quota is still at 0, then you have logged in with the incorrect user or did not follow the instructions properly)
- Almost there: Open up TimeMachine, select your “timemachine”-folder and the backup will start:
- For the first backup it is recommended to connect via LAN, as you will be able to get a throughput of 10-30MB/sec.
- Go back into DiskStation and hide the Shared Folder “timemachine”
If you ever need to restore your machine through the installation disk, open up Terminal once the DVD is booted and do the following:
$ mkdir /Volumes/TimeMachine
$ mount -t afp afp://TimeMachineUser:[email protected]/TimeMachineBackup /Volumes/TimeMachine
The above will mount the TimeMachine volume and once you return to the installation-manager will you be able to restore from the back.