eject time meachine partition

I have the following in Automator, Run /shell Script. The diskutil mount is the tm backup volume. This script runs and mounts tm and backs up tm. I just can't get the diskutil mount to unmount when the backup is completed



diskutil mount E88AFD73-C7B2-372F-88EC-E09A779D072E

tmutil startbackup


Mac Pro

Posted on Feb 28, 2020 11:33 AM

Reply

Similar questions

3 replies

Feb 28, 2020 12:06 PM in response to mrokloricred37

The issue is going to be knowing when the backup has completed and the disk is safe to unmount.


tmutil startbackup will initiate a backup, but there is no estimation of time, nor a callback that gets called when it finishes.


Off hand, the only way I can see to do this is via a periodic loop, probably using something like tmutil latestbackup and checking the results to see when it's finished.


Conceptually:


diskutil mount E88AFD73-C7B2-372F-88EC-E09A779D072E

LAST_BACKUP = `tmutil latestbackup`

tmutil startbackup

while `tmutil latestbackup` == $LAST_BACKUP do

sleep 30

end

diskutil unmount E88AFD73-C7B2-372F-88EC-E09A779D072E


(note: this is not a valid shell script, just a conceptual outline of what to do - record the latest backup value, start the backup, and continually wait until the backup completes (because tmutil latestbackup no longer matches the stored value), then unmount the disk.

Feb 28, 2020 12:51 PM in response to Camelot

Some thoughts…


I believe that after that latestbackup information is updated, that Time Machine continues its cleaning up activity for several minutes afterward before it officially quits. That cleaning up may be clearing cache, removing the oldest snapshot, or even Spotlight working on the latestbackup content on the Time Machine drive — all before Time Machine relinquishes its grip on the drive.


That unmount command might simply block until the drive is no longer in use, or hang because it cannot unmount it.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

eject time meachine partition

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.