Skip to content

Instantly share code, notes, and snippets.

@akshaysalunke13
Last active July 17, 2020 10:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akshaysalunke13/4a875178999c7be9da66b5d1a5148348 to your computer and use it in GitHub Desktop.
Save akshaysalunke13/4a875178999c7be9da66b5d1a5148348 to your computer and use it in GitHub Desktop.

Step 1 - Setup

Follow steps 1-3 here: https://www.howtogeek.com/276468/how-to-use-a-raspberry-pi-as-a-networked-time-machine-drive-for-your-mac/

Then:

  • sudo apt-get update
  • sudo apt-get upgrade
  • sudo apt-get install hfsplus hfsutils hfsprogs gdisk - To add HFS/HFS+ support to RPi

Step 2 - Install docker container for timemachine

Source: https://hub.docker.com/r/odarriba/timemachine/

docker run -h timemachine --name timemachine --restart=unless-stopped -d -v [internal/path]:/timemachine -it -p 548:548 -p 636:636 odarriba/timemachine-rpi

Replace [internal/path] with the path where HD Timemachine is mounted. (/media/tm in my case)

Add account: sudo docker exec timemachine add-account [USERNAME] [PASSWORD] [Display Name] [PATH=/timemachine]

Step 3 - Enable Auto Discovery

Avahi daemon is commonly used to help your computers to find the services provided by a server.

Avahi isn't built into this Docker image because, due to Docker's networking limitations, Avahi can't spread it's messages to announce the services.

If you want to enable this feature, you can install Avahi daemon on your host following these steps (Ubuntu version):

Install avahi-daemon:

  • run sudo apt-get install avahi-daemon avahi-utils
  • Copy the file from avahi/nsswitch.conf to /etc/nsswitch.conf
  • Copy the service description file from avahi/afpd.service to /etc/avahi/services/afpd.service
  • Restart Avahi's daemon: sudo /etc/init.d/avahi-daemon restart

Step 4 - Start Using It

To start using it, follow these steps:

If you use Avahi, open Finder, go to Shared and connect to your server with your new username and password.

Alternatively (or if you don't use Avahi) from Finder press CMD-K and type afp://your-server where your-server can be your server's name or IP address (e.g., afp://my-server or afp://192.168.0.5).

Go to System Preferences, and open Time Machine settings.

Open Add or Remove Backup Disk...

Select your new volume.

Helpful extra commands:

  • docker ps - Lists all running containers
  • docker rm containername - Delete container
  • docker stop container - Stop container
  • sudo lsblk -o UUID,NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL,MODEL - List all usb devices on rpi
  • netstat -a | grep PID - Check what'r running on port=PID
  • sudo chown pi:pi /media/tm - Grant RW permission
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment