We backup a macbook using a Seagate HFS+ external drive mounted on Ubuntu server and made accessible as a network drive to other MacOS machines over lan using Samba and Avahi.

Requires

On server:

  • samba
  • avahi

On client:

  • TimeMachine.app

Procedure

Erase existing volumes on drive

The external drive had previously been used for TimeMachine encrypted backups using the TimeMachine default APFS filesystem format, which has been the standard Apple file system format since 2017. As APFS format cannot be read-write mounted on Ubuntu, the drive must be erased and reformated to HPFS format which TimeMachine can also use for backups.

Opened Disk Utility app > View > Show All Devices

This shows the volumes nested in the container on the Seagate One Touch usb drive. To erase the encrypted volumes, for each volume on the Seagate:

Click volume > click Erase and select Mac OS Extended (Case-sensitive, Journaled) format.

The drive is now empty except for some system files, and contains no encrypted content.

Click container > Erase >

Name: Seagate
Format: Mac OS Extended (Journaled)
Scheme: GUID Partition Map

and click Erase.

Open Disk Utility > View > Show All Devices > click the container on the storage device > Partition > + > select Mac OS Extended (Case-sensitive, Journaled) format.

Mount drive

Refer to mount HFS/HFS external drive for how to mount an Apple HFS/HFS+ external drive on Ubuntu Server.

Configure drive as Samba share

Refer to setup Samba share to read how to configure Samba share accessible by TimeMachine for the external drive.

Add network drive to Mac client

On MacOS client, add the drive as a networked drive:

Open Finder.app > Go > Connect to Server enter:

smb://[my_user]@[my_host]

and click Connect. Login as Registered User with username my_user and password, using the Samba user and password created on the Ubuntu server.

This will add the host to the list of Locations in the Finder sidebar.

Setup TimeMachine on Mac client

On MacOS client, open TimeMachine to add the drive as a backup destination.

Open Time Machine > Click + to add a new backup destination > select backups-seagate-HFS > click Set Up Disk > enter

Registered User: on
Name: my_user
Password: my_pwd

where my_user and my_pwd are the user on our networked host that has samba share access and their samba password.

In the backup options window for backup-seagate-HFS - BUDMEISTER.local, choose these settings. Ensure Encrypt Backup is not selected.

Encrypt Backup: off
Disk Usage Limit: None

Backup then begins!

A full backup may take more than 12 hours over wifi. Although incremental backups should be less than several hours. To maximise backup speed:

  • Connect the client to LAN via ethernet.
  • Use 5GHz wifi if requiring wifi.
  • Schedule backups frequently, which should reduce the size of the backup diff.
  • Avoid schedule overlap with server upgrades which would halt the backup.

Configure weekly backups

Schedule backup frequency in Time Machine:

Select backup disk > Click Options > Backup Frequency: choose desired frequency

and click Done.

The Apple Time Machine documentation recommends Samba over Netatalk/AFP. However if backup over Samba is overly slow, we could try Netatalk.

Useful commands

  • id - Show user’s username and groups with uid and gids.
  • lsblk - List block devices
  • blkid [device_name] - Show the block id of specific device.
  • fdisk -l - List disks and volumes, including unmounted volumes.
  • mount -l - List mounted volumes.
  • testparm -s - Test samba configuration.
  • systemctl status smbd - Show Samba service status.
  • systemctl restart smbd - Restart Samba service.

References