Time Machine for MacBook's
Apple MacBook backups to a Docker based VM, `timemachine`. Adding the Samba share and then add the storage to your Time Machine as usual.
My laptop is a MacBook Pro, and we have 2 more MacBook in the house. Backups are essential. I run one to my main NAS, one to a remote disk and now adding a Docker based to it, it runs Samba as for the storage.
I use a Docker and Samba combo from Thomas Willems, willtho89 on GitHub. This is an old project without updates for 5 years, but it still works in our house.
Installation
I use Dockge as my tool to deploy and manage Docker Compose files. Use a small VM 1 core, RAM 1 GiB, 8Gib Disk, and add a data disk of a proper size e.g., 256 GiB on a ZFS-2 device. The same VM also does my Syncthing storage on a different 32 GiB Disk. You should install avahi on this VM.
Add the storage for the synchronized files
Add a virtual disk (sdb) and create a partition on it. Make a filesystem mkfs.ext4 /dev/sdb1
and mount it with sudo mount -t auto -v /dev/sdb1 /sync/
.
Find the UUID ls -l /dev/disk/by-uuid
and edit /etc/fstab
, add the line /dev/disk/by-uuid/<UUID> /sync ext4 defaults 0 2
. The fs_passno of 2 means check filesystem after the root filesystem is checked, for no check use 0
.
The root filesystem should be specified with a fs_passno of 1. Other filesystems should have a fs_passno of 2. Filesystems within a drive will be checked sequentially, but filesystems on different drives will be checked at the same time to utilize parallelism available in the hardware. Defaults to zero (don’t check the filesystem) if not present.
The Dockge files
Set up MacBook
Connect to the server running the VM smb://<IP>
and login.
Go to Time Machine settings and add a new destination.
Increase virtual disk size
When the disk size runs out, you need to expand the vdisk and run two commands in the VM. It usually ends up to be too small.
- Go to Disk Action and tell how much more space you like to have in GiB
sudo growpart /dev/sdd 1 --update auto
sudo resize2fs /dev/sdd1
- Check for success
df -h
References
The Docker Samba Timemachine [1] Install Docker and Dockge on a VM [2]