Skip to content

Create Time Capsule with Raspberry Pi and external HDD

Notifications You must be signed in to change notification settings

rafaelmaeuer/timecapsule-pi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Time Capsule on Raspberry Pi

Running Time Machine Server on Raspberry Pi using an exFAT HDD

Inspired by macOS Backup Raspberry Pi als NAS mit TimeMachine

TimeMachine on RPi4

1. Add exFAT support

As there are no good options to use a HDD with APFS or HFS+ for read/write with a Raspberry Pi, exFAT is the filesystem of choice, as it can be read by macOS which is not possible for ext4 without any additional tools.

  • Update dependencies

    sudo apt-get update
    sudo apt-get upgrade
  • Install exFAT utilities

    sudo apt-get install exfat-fuse
    sudo apt-get install exfat-utils
  • Format HDD with exFAT

    # replace {sdxn} with mounting point, e.g. sda1
    mkfs.exfat /dev/{sdxn}

2. Install Netatalk

For the Raspberry Pi to act as a NAS (Time Capsule) the program netatalk is required.

  • Install netatalk

    sudo apt-get install netatalk
  • Configure netatalk

    Add in configuration file /etc/netatalk/afp.conf (replace {NameOfHDD} with HDD name)

    [TimeMaschine]
    path           = /media/pi/{NameOfHDD}
    time machine   = yes
    valid users    = pi
    unix priv      = no

    To solve the problem that netatalk can't create directories on exFAT unix priv = no is required (Link)

  • Restart netatalk and Raspberry Pi

    service netatalk restart
    sudo reboot
  • Test service and drive mount (replace {NameOfHDD} with HDD name)

    ps aux | grep netatalk
    df /{NameOfHDD}
    mount | grep /{NameOfHDD}

3. Restart Netatalk after boot

As macOS doesn't recognize the backup drive after start adding a restart script is required

  • Copy scripts folder to /home/pi/

  • Enable system service to run restart.sh on startup

    sudo systemctl enable /home/pi/scripts/restart.service --now
    sudo systemctl daemon-reload

4. Spin-Down HDD on shutdown

In order to spin down the HDD manually or on shutdown, another script is necessary

  • Copy contents of desktop folder to /home/pi/desktop
  • Replace {NameOfHDD} with HDD name in scripts/ejectHDD.sh

Now a manual eject of HDD or shutdown including spindown of HDD is possible using the desktop shortcuts. Therefore a capable cable is required as Startech eSATA/USB3 (only RevA is working, spindown with RevB doesn't work anymore)

5. Find Time Capsule with macOS

However, macOS does not recognize the self-created Time Capulse until the unsupported devices feature is enabled

  • Enable unsupported devices on desired mac to backup

    defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
  • Open Time Machine, search for Volumes, select {NameOfRaspberryPi}.local

  • Login with same credentials as used to login with the raspberry

  • Create Backups and enjoy :)

Sources

About

Create Time Capsule with Raspberry Pi and external HDD

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages