Can Time Machine backup to a folder on a Samba Share? - Ask Different
mac - Configure Samba correctly for TimeMachine and other shares - Ask Different
Big Sur + SMB based Time Machine | Apple Developer Forums
Any Way to use a SMB Server for Time Machine?
Videos
Yes, it can. (I've been doing this for years.)
Types of disks you can use with Time Machine on Mac
On network volumes, TM backups are stored as sparsebundles.
Samba v4.8 or higher, has to be configured with macOS extensions, plus the share has to be configured for Time Machine.
Configure Samba to Work Better with Mac OS X
Depending on the host system, there might be a GUI (Synology DSM), otherwise Samba's smb.conf needs to be modified accordingly.
Starting with macOS Tahoe, the AFS protocol for Time Machine is no longer accepted. One must use Samba with modern macOS for a homemade Time Machine.
At the time of writing, Tahoe is the latest macOS.
Install
samba. Make a groupsmbgroupand add a new user intended to only be used with the Samba connection:sudo groupadd smbgroupsudo useradd -M -s /usr/sbin/nologin timemachinesudo usermod -aG smbgroup timemachine
Set that new user's Samba password with
smbpasswdand enable the account:sudo smbpasswd -a timemachinesudo smbpasswd -e timemachine
Set up ACL support
sudo apt install acl(or equivalent for your package manager if not using a Debian-based distro)
Create the Time Machine directory. I keep it in
/srvas it's the idiomatic place to keep it on Linux.sudo mkdir -p /srv/timemachinesudo chown timemachine:smbgroup /srv/timemachinesudo chmod 2770 /srv/timemachine- We use 2770 rather than 770 because the 2 (setgid bit) ensures new files are owned by smbgroup.
Add ACLs
sudo setfacl -m group:smbgroup:rwx /srv/timemachinesudo setfacl -d -m group:smbgroup:rwx /srv/timemachine
There are several guides on how to configure smb.conf correctly for Time Machine. I will share my config below, just in case it helps. This is on Debian 13 and only serves macOS clients on Sequoia and Tahoe. I don't use Avahi/Zeroconf because the server remains connected around the clock without any issues.
[global]
server role = standalone server
workgroup = WORKGROUP
netbios name = fileserver
security = user
log file = /var/log/samba/log.%m
max log size = 1000
server min protocol = SMB3
client signing = required
obey pam restrictions = yes
pam password change = yes
unix password sync = yes
inherit acls = yes
map to guest = Bad User
vfs objects = catia fruit streams_xattr
fruit:metadata = stream
fruit:resource = stream
[TimeMachine]
path = /srv/time-machine
browsable = yes
read only = no
guest ok = no
valid users = @smbgroup
vfs objects = catia fruit streams_xattr
fruit:time machine = yes
fruit:model = TimeCapsule
fruit:metadata = stream
create mask = 0660
directory mask = 0770
Pro Tip: If making a fresh partition for Time Machine use, XFS is recommended more so than EXT4, because XFS is not susceptible to issues that could arise with an EXT4 FS, especially on larger drives. Basically, each file creates an inode for its metadata, but you have a limited number of inodes in ext4, whereas this isn't a problem that exists in XFS. This matters because Time Machine creates many very small files, so it would be possible to run out of inodes. This is what -T news exists for (the term is from news servers would would have many small text files). Formatting ext4 with -T news gives you more inodes if XFS isn't an option, so if you must use ext4, it would be recommended to format it with the news flag.
I have a 27" iMac (2020) and want to back it up with Time Machine. Recently I set up a NAS using a Raspberry Pi 4 and a 6TB WD Elements External HDD. Now I want to use this NAS as a Backup Server with Time Machine.
If I remember correctly, you create a TimeMachine Sparsebundle, mount it and set it as destination using "tmutil" in the Terminal. But every time I have done this, after a Week it would say to me that it needs to create a new Backup to enhance reliability or something.
So, my question is what I am doing wrong and if there is any way to prevent the Backup from corrupting?