-- Mount Image
on mountSparsebundle(filePath)
try
-- Mount the sparsebundle
do shell script "hdiutil attach " & quoted form of filePath
--display dialog "Sparsebundle mounted successfully!" buttons {"OK"} default button "OK"
on error errMsg
--display dialog "Error: " & errMsg buttons {"OK"} default button "OK"
end try
end mountSparsebundle
mountSparsebundle("/Path/to/file.sparsebundle")
Issue:
at times I get the following error:
tell current application
do shell script "hdiutil attach '/Path/to/file.sparsebundle'"
--> error "hdiutil: attach failed - Resource temporarily unavailable" number 1
end tell
If I manually try to open the file I get this error
Current Fix:
the fix is to reboot the computer.
Question:
how do I fix it so that I reboot is not required to mount this image? Is there some additional code that can be executed for this to mount?
Plus… I’m sure you have your reasons to regularly mount Time Machine sparsebundles by script or manually. But that’s obviously not an intended or recommended use of TM data. I don’t know if it can be reliable. You may want to rethink the workflow that requires this step in the first place.
(I personally don’t have any experience with manual manipulation of TM sparsebundles though; maybe there are use cases I’m not aware of.)
It appears that as long as you attempt to work with an active Time Machine sparsebundle, you’ll keep running into this error.
You can try some trickery like stopping TM before mounting the volume, then restart it. Or poll for this error in a loop until you’re able to mount it.
I have no idea if any of this can be successful
Is it a problem with your particular Time Machine operation, or is it a general Time Machine issue that all users experience? If the latter, then how do other users deal with it?