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


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


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, in 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 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.

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.

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

OpenPlotter V3, install guide

OpenPlotter v4 , install guide

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

Raspberry headless install with WiFi

Victron monitoring solution, Venus, on Raspberry

HomeKit bridge with Ring

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

IVT, Bosch heat pump easy integration, Home Assistant

Signal K quick install, Raspberry Pi, Ubuntu