NOTE: Use these steps for APFS backups. If you have an HFS backup, use: https://gist.github.com/gadgetmies/3e1336d6d8733ecc199a5123671efd33
I got frustrated with the "Disk Not Ejected Properly" warnings I often got when disconnecting my laptop from the USB dock because I had not unmounted the Time Machine backup disk first. Decided it's probably best to do something about the issue before the disk gets damaged.
The solution is rather simple and has three parts:
- Store the disk encryption password in your keychain and always allow it's use for mounting the disk
- Prevent automatic mounting of the backup disk to prevent it being mounted when disconnecting the laptop from the dock
- Create an application that mounts the disk, runs the Time Machine backups and unmounts the disk when done
The application can be launched manually (e.g. from the MacOS dock) or be scheduled to run every now and then.