Time Machine Samba Backup
I'm hoping someone can give me some pointers. M1 Macbook Pro - Sequoia 15.3.1
I've a NAS on which I've been running afp and have a sparse bundle time machine backup there. I want to convert to smb.
I have successfully managed to backup using the following steps.
Use Finder-Go To Server and open the backup share by entering the NAS as smb://nas.file.share.ip and selecting the correct file share. This mounts as:
//user@nas.file.share.ip/name_of_folder on /Volumes/name_of_folder
In that folder there is a macbook_pro_name.sparsebundle which I mount by right clicking and opening with DiskImageMounter.App
This mounts as:
/dev/disk5s1 on /Volumes/Backups of macbook_pro_name (apfs, local, nodev, nosuid, journaled, mounted by user)
I can then use:
sudo tmutil setdestination /Volumes/Backups\ of\ macbook_pro_name
sudo tmutil inheritbackup /Volumes/Backups\ of\ macbook_pro_name
tmutil detsinationinfo to verify and grab the ID
sudo tmutil setquota ID #Gigabytes
Once done I can then manually start a TM backup.
I want to execute these steps at login of my user, but adding the mounted volumes to login items causes the sparse bundle mount to fail as the SMB mount hasn't completed. I would also like to suppress the finder windows that open when I am doing this.
I have tried a zsh script similar to this:
#!/bin/zsh
mount_smbfs -o nobrowse //user:password@nas.file.share.ip/name_of_folder /Users/user/Not_Backed_UP_Folder/TM
sleep 30
hdiutil attach /Users/users/Not_Backed_UP_Folder/TM/macbook_pro_name.sparsebundle
This also creates the following mount:
/dev/disk5s1 on /Volumes/Backups of macbook_pro_name (apfs, local, nodev, nosuid, journaled, mounted by steve)
However now a manual TimeMachine backup fails.
Can someone suggest how I can automate the mounting of both the smb share and the sparsebundle at startup that mirrors the manual steps above, ideally without opening the finder windows that the manual steps do.
MacBook Pro 16″