Apple Time Machine backup targeting Linux or Proxmox LXC

My old AirPort Time Capsule will not work with the new version of Mac OS 27 and since I really would like to have a local backup, besides iCloud, the tinkering started.

It ended up with a Linux solution and an external USB disk, 2 Tb.

In this post will show "how to" create a target for the Time Machine(TM) backup with a standard Linux host or with a Linux container in Proxmox + a Proxmox backup to the same SSD


Time Machine
Standard setup
In a Debian or Ubuntu distro you use "apt" to install Samba, filesharing, and avahi, zeroconf.

sudo apt update
sudo apt install samba avahi-daemon

and then add an user. The most convenient way is to use the same user name as in Mac OS

adduser mac_user


My USB disk is partitioned as below

lsblk

:

:

sdb   8:16   0   1.8T  0 disk 

├─sdb1    8:17   0 186.3G  0 part => Backup

├─sdb2    8:18   0   1.4T  0 part => Files

└─sdb3    8:19   0 279.7G  0 part => Time Machine


For the TM backups I created a directory

mkdir -p /mnt/timemachine


in a home server environment you can make it simple 


chmod -R 777 /mnt/timemachine 

mount /dev/sdb3 /mnt/timemachine

configure Samba with "nano /etc/samba/smb.conf" and add the following at the end

 [TimeMachine]
    path = /mnt/timemachine
    valid users = mac_user
    writeable = yes
    fruit:time machine = yes
    vfs objects = catia fruit streams_xattr

Add the "mac_user" to Samba with 

pdbedit -a mac_user


Then test configuration with "testparm -s" and restart Samba with "sudo systemctl restart smbd"
On the Mac open TM "System Settings => General => Time Machine", add the created server
and take your backup.

Proxmox LXC setup
First check that the disk is available, at node level, "Proxmox => Disks" and note their name.

In Proxmox I created a Debian LXC, container id 207, and installed Samba, avahi and added the user as above. On the Proxmox host/Node then executing the commands

mkdir -p /mnt/timemachine

chmod -R 777 /mnt/timemachine 

mount /dev/sdb3 /mnt/timemachine

pct set 207 -mp2 /mnt/timemachine,mp=/mnt/timemachine


(If you want to delete the mountpoint use "pct set 207 -delete mp2")

On the LXC guest(207) check the added disk with "df -h" and continue with
sudo apt update
sudo apt install samba avahi-daemon
adduser mac_user


Then add the Samba config as above. On the Mac add the created server and do the backup.

Mount surviving a boot
If you want to make the "mount" to survive a boot you have to add, at the host, the disk in "fstab". Get the UUID for "sdb3", in my case, with "lsblk -f", and then 
"nano /etc/fstab"and add "UUID=your-disk-uuid /mnt/timemachine ext4 defaults 0 2"
If you want to check the "fstab" entry do "umount /mnt/timemachine && mount -a"

Proxmox backup
As root, at the host, start with creating the directory "mkdir -p /mnt/pxbackups" and then


mount /dev/sda1 /mnt/pxbackups


If you want it persistant during boots check above.
Then in PX you have to add the storage

Datacenter => Storage => Add => Directory => ID:ProxmoxBackup => Directory:/mnt/pxbackups => Content:Backup => OK

In "Datacenter => Backup" set up a backup schema with the created storage and run the backup.

If you want that the "mac_user" schould have the possibility to check the backup folder via "Finder" run, at the host, "pct set 207 -mp3 /mnt/pxbackups,mp=/mnt/pxbackups" and then, at the guest, add to the Samba config

[PXBackups]
    path = /mnt/pxbackups
    valid users = mac_user
    read only = yes
    browseable = yes
    force user = root
    vfs objects = catia fruit streams_xattr

Samba remarks
Latest Samba
In Debian you can add Backports to get the latest version.

nano /etc/apt/sources.list => and add => 

deb http://deb.debian.org/debian trixie-backports main

apt update

apt install -t trixie-backports samba 


This was done due to that there been some changes in TM which is covered in the latest Samba.

Mac mounts
If a Mac mounts several shares simultaneously it could be a good idea to put "vfs objects = catia fruit streams_xattr" on the "[global]" level, in "smb.conf", and skip it in the other places.

Add-on
If you setup the TM to backup manually you can use the TimeMachineEditor to do a more granular approach.

Comments

Popular posts, last 30 days

iCloud drive sync, or mount, with a Linux, Ubuntu, device

Installing Ubuntu 24.04 or 26.04 on an old MacBook Air(2011)

Raspberry Pi OS Lite with GUI, RDP, VNC, Chromium

Home Assistant with VirtualBox or Proxmox or Linux KVM ???

NetworkManager UI and access point, hotspot

Signal K quick install, Raspberry Pi, Proxmox, Ubuntu, Debian

Understand/Install Openplotter/OpenCPN/SignalK, I

AIS receiver and dispatcher ! The best ?!

SeaTalk1 to NMEA 0183 converter, DIY

IVT, Bosch heat pump easy integration, Home Assistant