You can back up your data to external storage connected to your Mac or available in your network. You can use the command to add your backup location for a shared Mac:
tmutil setdestination –a smb://<user>:<passoword>@<ip address>:/<backup hard drive name>
To add an external drive as a backup location:
tmutil setdestination –a /Volumes/backupdrive
“backupdrive” is the name of the drive plugged into your Mac as the backup destination.
To check added backup destinations:
tmutil destinationinfo
For each backup location, the command displays name, type and ID. For network destination, the URL used is displayed and for external drives mounted, the Mount Point path in the file system is displayed.
If multiple backup locations are added, you can choose one using:
tmutil setdestination <arg>
When –a is not provided, the current list of destinations is replaced by the backup location.
Remove destinations with:
tmutil removedestination <destination_id>
destination_id is the ID returned by destinationinfo command.
Exclude files and folders from Time Machine backup using:
tmutil addexclusion <path>
These exclusions will remain in the Time Machine exclusion list even if you remove them. Add the –p flag to remove it from the exclusion list.
tmutil addexclusion -p <path>
Confirm if a file has been excluded:
tmutil isexcluded <path>
For removing an exclusion use:
tmutil removeexclusion <path>
Once all unwanted files and folders are excluded start the backup process. Enable and start the backup process using:
tmutil enable
tmutil startbackup
Check the status of a backup using the command:
tmutil status
This command returns ClientID, percentage, running status, destination ID and other data that returns the status of the backup process.
Stop the backup process if your device is running slow. Pause backup using
tmutil stopbackup
Disable time machine backup with:
tmutil disable
To view all backups use:
tmutil listbackups
Since your laptop isn’t always connected to its backup disk, Time Machine retains “local snapshots,” or files that it will copy to your backup disk the next time it is available. However, these local snapshots take up space, and you may want to turn this feature off if you don’t have much room on your hard disk. You can do so with:
tmutil disablelocal
Running this command will also delete any local snapshots. You can turn local snapshots back on by running:
tmutil enablelocal