This tutorial will show you how to use a Cubieboard + one 2.5″ hard drive to backup your Mac (or your Hackintosh), just like you would use an Apple TimeCapsule. I will assume that you already have a Cubieboard or Cubieboard 2 with Cubian installed, some kind of terminal access (for instance via SSH), and a SATA hard drive connected to the SATA port. An USB connected hard drive should work fine too.
You can learn how to install Cubian on your SD-card here: https://github.com/cubieplayer/cubian/wiki/Install-Cubian. Instead of using Image Writer, I recommend using Win32 Disk Imager.
To make your Cubieboard work like a TimeCapsule, you need to:
- configure and connect your hard drive, install support for the HFS+ filesystem
- install and configure the Avahi and Netatalk daemons
Connecting your hard drive
The hard drive needs to be formatted as Mac OS Extended (Journaled). To do that, connect it to your Mac (probably via USB), open Disk Utility, select your drive in the left side box, and click Partition on top. In the Partition Layout box select 1 Partition, in the Name field type a name (like Data, TimeMachine, or Backup), in the Format box select Mac OS Extended (Journaled), and click Apply. Please note that this erases everything on the selected disc, so make sure the right drive is selected. Once the operation is complete, you can unplug the drive from your Mac and get back to the Cubieboard.
With that out of the way, connect the hard drive to your Cubieboard, start it up and connect via SSH.
Let’s install the support for the HFS+ filesystem by issuing the following command:
sudo apt-get install hfsplus
Once the process is complete, let’s try to identify and mount the disc:
sudo blkid
The above command should output something like this:
cubie@Cubian:/$ sudo blkid /dev/nanda: SEC_TYPE="msdos" LABEL="Volumn" TYPE="vfat" /dev/nandd: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b" TYPE="ext4" /dev/nande: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b" TYPE="ext4" /dev/nandh: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b" TYPE="ext4" /dev/nandi: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b" TYPE="ext4" /dev/nandj: LABEL="NUCLEAR" UUID="38DC-07B2" TYPE="vfat" /dev/sda1: LABEL="EFI" UUID="67E3-17ED" TYPE="vfat" /dev/sda2: UUID="07291167-3ca6-3be7-8ddb-6e83fcc58186" LABEL="Data" TYPE="hfsplus" /dev/mmcblk0p1: LABEL="cubieboard" UUID="68ed2b81-d507-4d85-a8ed-261bff7666bf" TYPE="ext4"
Look for the label you used when you formatted the drive (Data, TimeMachine etc.) and the TYPE=”hfsplus”. On my board it gives this line:
/dev/sda2: UUID="07291167-3ca6-3be7-8ddb-6e83fcc58186" LABEL="Data" TYPE="hfsplus"
Note down the UUID too, because we will need it later (you can actually issue the command again when you need it), and use the following commands to mount /dev/sda2:
sudo mkdir /mnt/TimeMachine sudo mount -o force /dev/sda2 /mnt/TimeMachine
The partition should now be mounted under /mnt/TimeMachine, so you can change to that directory, and create some files to make sure it’s working correctly. You may need to change permissions/ownership on /mnt/TimeMachine or use sudo. To change ownership do:
sudo chown cubie:cubie /mnt/TimeMachine
If everything checks, let’s make sure the drive is mounted automatically on reboot. Edit /etc/fstab and add the following line at the end:
UUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" /mnt/TimeMachine hfsplus rw,force,exec,auto,users 0 3
Don’t forget to replace xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx with your actual UUID, as shown by blkid. Your /etc/fstab file should look something like this:
#<file system> <mount point> <type> <options> <dump> <pass> /dev/mmcblk0p1 / ext4 defaults 0 1 tmpfs /tmp tmpfs defaults 0 0 tmpfs /var/tmp tmpfs defaults 0 0 UUID="07291167-3ca6-3be7-8ddb-6e83fcc58186" /mnt/TimeMachine hfsplus rw,force,exec,auto,users 0 3
You should now reboot and see if the disc is correctly mounted. After the reboot, issue the command mount and you should get something like this:
/dev/root on / type ext4 (rw,relatime,data=ordered) devtmpfs on /dev type devtmpfs (rw,relatime,size=414336k,nr_inodes=103584,mode=755) tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=82892k,mode=755) tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k) proc on /proc type proc (rw,nosuid,nodev,noexec,relatime) sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime) tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=165780k) devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000) tmpfs on /tmp type tmpfs (rw,relatime) tmpfs on /var/tmp type tmpfs (rw,relatime) /dev/sda2 on /mnt/TimeMachine type hfsplus (rw,nosuid,nodev,noexec,relatime,umask=22,uid=0,gid=0,nls=utf8)
We are interested in the last line. It shows that the partition is mounted under the correct directory, as read-write, which is important.
Install Netatalk and Avahi on the Cubieboard
We now have to install the services and libraries that the Cubieboard needs to communicate with the Mac:
sudo apt-get install avahi-daemon libavahi-client-dev libdb-dev db-util db-util libgcrypt11 libgcrypt11-dev make
This may take a while, since it installs some dependencies too. Grab a tea.
We need to install Netatalk from source. No need to be scared, I’ll hold your hand. First, download Netatalk. At the moment of writing this, the latest stable version is 3.1.0:
wget http://prdownloads.sourceforge.net/netatalk/netatalk-3.1.0.tar.gz?download -O netatalk.tar.gz
Make sure you’re in your home folder before downloading.
tar xzf netatalk.tar.gz cd netatalk* ./configure --with-init-style=debian --with-zeroconf make sudo make install
Building Netatalk will take a while too. Why not grab another cup of tea?
With everything installed, all we need to do now is configure Netatalk:
sudo nano /usr/local/etc/afp.conf
Delete everything and replace with:
; ; Netatalk 3.x configuration file ; [Global] ; Global server settings hostname = TimeCapsule Cubie afp listen = 192.168.0.18 <-- replace with your Cubieboard static IP log file = /var/log/netatalk.log log level = default:info [Homes] basedir regex = /home cnid scheme = dbd ; Display each user home directory in this format home name = Home: $u [Time Machine] ; Our Time Machine volume path = /mnt/TimeMachine cnid scheme = dbd file perm = 0660 directory perm = 0770 time machine = yes
And Avahi:
sudo nano /etc/avahi/services/timecapsule_afpd.service
Write this in the above file:
<?xml version="1.0" standalone='no'?> <!DOCTYPE service-group SYSTEM "avahi-service.dtd"> <service-group> <name replace-wildcards="yes">TimeCapsule Cubie</name> <service> <type>_afpovertcp._tcp</type> <port>548</port> </service> <service> <type>_device-info._tcp</type> <port>0</port> <txt-record>model=TimeCapsule</txt-record> </service> </service-group>
Now start the services:
sudo /etc/init.d/netatalk start sudo /etc/init.d/avahi-daemon start
Ensure the services are started at every boot:
cd /etc/init.d/ sudo update-rc.d netatalk defaults
That’s it! Now grab your Mac. You should already see the new TimeCapsule Cubie share.
Select the share, click Connect As… in the top right corner and enter your Cubieboard credentials (default for Cubian is username: cubie, password: cubie).
It takes a little while to authenticate…
…and you should see something like this…
Now open Settings…
…click Time Machine…
…then click Select Backup Disk and you should see your new Time Machine:
Select it and then click Use Disk.
Confirm your credentials or enter them if they weren’t saved…
…and you’re done! Backup should begin shortly. If you want to back up your files while on battery, make sure to click Options and set that up.
I have this problem :
What i can do ?
Mar 17 01:42:44.355196 afpd[28145] {dsi_tcp.c:414} (E:DSI): dsi_tcp_init: no suitable network config for TCP socket
Mar 17 01:42:44.355323 afpd[28145] {afp_config.c:194} (E:Default): no suitable network address found, use “afp listen” or “afp interfaces”
Mar 17 01:42:44.355426 afpd[28145] {main.c:321} (E:AFPDaemon): main: no servers configured
Mar 17 01:42:44.358288 netatalk[27946] {netatalk.c:195} (I:Default): child[28145]: exited 2
Mar 17 01:42:44.502755 netatalk[27946] {netatalk.c:227} (N:AFPDaemon): Restarting ‘afpd’ (restarts: 127)
Mar 17 01:42:58.356793 afpd[28147] {status.c:644} (I:AFPDaemon): signature is 71554E96FA734C4B1EDC91618FC07B55
Mar 17 01:42:58.359009 afpd[28147] {auth.c:110} (I:AFPDaemon): uam: “DHX2” available
Mar 17 01:42:58.360080 afpd[28147] {auth.c:110} (I:AFPDaemon): uam: “DHCAST128” available
Mar 17 01:42:58.360931 afpd[28147] {status.c:363} (I:AFPDaemon): servername: TimeCapsule
Mar 17 01:42:58.361798 afpd[28147] {afp_config.c:125} (N:AFPDaemon): Netatalk AFP/TCP listening on 192.168.1.23:548
Mar 17 01:42:58.362930 afpd[28147] {dsi_tcp.c:367} (E:DSI): dsi_tcp_init(<–): getaddrinfo: Name or service not known
./configure –with-init-style=debian –with-zerocon
=> configure: error: –with-init-style=debian is obsoleted.
Use: –with-init-style=debian-sysv instead