First access to external disk on Mac M1


With 2 apps (written in Xojo), I have a problem of a very long delay when the app try to access for the first time to an external disk on Mac M1.
This long delay comes again if I unmount and mount again the external disk.
How can I fix this problem?

Fire “Utilitaires de disque" and repair the external volume (and the internal one too).

You may also download “Blackmagic Disk Speed Test” and check the speed of your hard disks. It is free and will return the write and read speed for the disk you choose (boot disk by default).

Don’t you have a dialog asking you for permission to access the disk ?

Also: I never had that.

how long the delay?
are there messages in while this happens?

Maybe macOS checks whether your app was granted access or first does some bookkeeping for the disk?

You can’t, AFAIK, apps need permission from the user to access an external disk.

Thanks all!

This problem occurs at least on 2 different external disks, therefore it is not a problem from the disk.
The delay is about 35 secondes.
No dialog to ask the permission.
In the console, I have some “Spin Reports” but I don’t know how read them.

Look in your system preferences under Battery and see if you have the option checked to let the system spin down drives when they’re not in use. If so, try turning that off. I wouldn’t expect 35 seconds, but the length of time depends on the drive. I’ve got a really old RAID here that causes a 20 second delay when it spins up.

I’ve found that since at least Mac OS 12 came out (and possibly earlier, I don’t recall), all my external disks always spin down after some delays, regardless of the settings in system preferences. Searching on the Internet revealed I’m not alone in that case; it’s like if the OS disregards “Prevent disk sleeping”. And I fairly know they used to not spin earlier (in 10.14, for instance).
I’ve aborted trying to find an explanation to this, but still would like to.

Since I was tired of all my USB disks spinning down all the time and slowing down the computer, I made a Xojo app to periodically create a hidden file on them, preventing the sleep :slightly_smiling_face:. It still should be the task of “Prevent disk sleeping”, if it wasn’t broken.

But, over 30 seconds of duration, I can’t think it would be automatic disk sleeping :man_shrugging:

Incredible !

I have nearly the reverse behavior here… Since some years, my HDD/SSD always had their LED ON…

Some years ago, the LED shine on Open or Save time and shut once the operation is done…Regardless Power setting (ON/OFF) and the other System Preference.

At first, I feated about some virus, but since no report…

There’s probably nothing weird here: a process is keeping your disk awake.
In Terminal, use “lsof /PathToYourDisk” (or “sudo lsof /PathToYourDisk” if nothing’s found with just “lsof”) to find which process has files in use on your disk (you can drag&drop the disk on the Terminal window after you’ve typed “lsof ”).

But all the time (excepted when the computer is sleeping) ?
(Intel and m1)…

I will check.

Why not? Your computer doesn’t use your disks only when you save or open documents, you know.
mds (Spotlight) and TimeMachine are, for instance, frequently using your disks at time you won’t necessarily notice.