A docker-compose based samba server compatible with MacOS's TimeMachine.
Quickly deployable on Raspberry Pi.
- docker
- External Storage Device, connected to docker host (Raspberry Pi)
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 3.6T 0 disk
└─sda1 8:1 0 3.6T 0 part
mmcblk0 179:0 0 119.4G 0 disk
├─mmcblk0p1 179:1 0 512M 0 part /boot/firmware
└─mmcblk0p2 179:2 0 118.9G 0 part /In this example, the device name is /dev/sda1.
We will refer to this as $DEVICE moving forward.
$ export DEVICE=/dev/sda1We'll refer to this as $MOUNT_POINT moving forward
$ export MOUNT_POINT=$PWD/tm_data
$ mkdir $MOUNT_POINT$ sudo mount $DEVICE $MOUNT_POINTTo check your work, use lsblk again
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 3.6T 0 disk
└─sda1 8:1 0 3.6T 0 part /path/to/mounted/tm_data$ cp example.env .envUse the included convenience script to get the device size:
$ env DEVICE=$DEVICE ./device_get_size.sh
DEVICE = /dev/sda1
SIZE_MB = 3906982908
$ export SIZE_MB=3906982908Edit the .env file
| Var | default | description |
|---|---|---|
| TM_PASSWORD | timemachine | password to connect to the samba share |
| TM_SHARENAME | timemachine | the name of the network share |
| TM_DEVICE_MONUT_POINT | set this to $MOUNT_POINT |
|
| TM_DEVICE_SIZE_MB | the size of the share in Megabytes (MB); set this to $SIZE_MB |
docker compose up -d- Run
docker-compose logs -fto watch the container logs
- Run
docker compose down -v- unnount the drive:
sudo umount $DEVICE $MOUNT_PONIT- this will remove the docker volumes but will not touch the data on the mounted disk
All testing has been done on the following hardware and software:
- Raspberry Pi 4B 4GB; RaspberryPi OS Lite (64bit)
- Raspberry Pi 4B 8GB; RaspberryPi OS Lite (64bit)
- Raspberry Pi 5 8GB; RaspberryPi OS (64bit)