环境:
- 源机器:macOS Sequoia 15.2
- 目标机器(SMB 服务器):Windows Server 2025 24H2
注:SMB 共享的创建与挂载此处不再赘述。
macOS 时间机器只能备份到一个完整的磁盘,所以核心思路是
- 在 macOS 上创建一个磁盘映像;
- 将其复制到 SMB 服务器;
- 从 macOS 挂载该映像;
- 将挂载点设置为时间机器目标。
尝试过程
一开始使用磁盘工具 GUI创建磁盘映像,复制到 SMB 服务器后,挂载可以正常读写,但无法被时间机器识别。
于是改用 纯命令行方法,稍作修改,核心步骤如下:
使用 hdiutil 创建虚拟磁盘文件
hdiutil create \
-size 500g \
-type SPARSEBUNDLE \
-nospotlight \
-volname "TimeMachine" \
-fs APFS \
-verbose \
~/Documents/TimeMachine.sparsebundle
说明:
-size 500g
:设定映像大小(可自行调整)。-type SPARSEBUNDLE
:稀疏捆绑包格式,实际占用空间会随数据增长。-nospotlight
:避免 Spotlight 索引该卷。-volname "TimeMachine"
:挂载后的卷名。-fs APFS
:文件系统为 APFS。~/Documents/TimeMachine.sparsebundle
:映像保存路径。
复制到 SMB 服务器并挂载
将生成的 TimeMachine.sparsebundle 文件夹复制到 SMB 共享目录。
双击挂载
挂载完成后,可以在 /Volumes/TimeMachine 下访问。
设置为时间机器目标
执行:
sudo tmutil setdestination -a /Volumes/TimeMachine/
此时会报错:
tmutil: setdestination requires Full Disk Access privileges.
To allow this operation, select Full Disk Access in the Privacy
tab of the Security & Privacy preference pane, and add Terminal
to the list of applications which are allowed Full Disk Access.
解决方法
这是因为 tmutil 没有完全磁盘访问权限。
解决方法:
- 打开系统偏好设置 → 安全性与隐私 → 隐私 → 完全磁盘访问;
- 点击左下角锁图标解锁;
- 为 Terminal添加完全磁盘访问权限;
- 重启终端,再次执行 tmutil 命令。
完成后,时间机器就能正常备份。