Stop macOS from accessing external drive at night

I have Mac Mini Mid 2011 with macOS 10.13.5 with a data drive. When I wake up at night, the drive is running. I ran fs_usage and was surprised to find macOS accessing the drive a lot.

How do I stop macOS from spinning the drive, except when accessed by a human, or at least not at certain hours when I sleep? Can Spotlight/macOS be configured to lay off the drive at night?

00:01:10  fsgetpath         /Volumes/FOOBAR  0.000022   mds
00:01:10  statfs64          /Volumes/FOOBAR  0.000015   Finder
00:01:10  getattrlist       /Volumes/FOOBAR  0.000017   Finder
00:08:59  getattrlist       /Volumes/FOOBAR  0.000019   backupd-help
00:39:54  getattrlist       /Volumes/FOOBAR  0.000031   diskspaced
00:39:54  getattrlist       /Volumes/FOOBAR  0.000081   diskspaced
00:39:54  statfs64          /Volumes/FOOBAR  0.000014   diskspaced
01:08:47  getattrlist       /Volumes/FOOBAR  0.000017   backupd-help
02:08:35  getattrlist       /Volumes/FOOBAR  0.000020   backupd-help
03:08:40  getattrlist       /Volumes/FOOBAR  0.000033   backupd-help
04:04:09  getattrlist       /Volumes/FOOBAR  0.000019   fontworker
04:04:39  getattrlist       /Volumes/FOOBAR  0.000015   fontworker
04:11:01  getattrlist       /Volumes/FOOBAR  0.000032   backupd-help
05:11:56  getattrlist       /Volumes/FOOBAR  0.000052   backupd-help
06:05:23  getattrlist       /Volumes/FOOBAR  0.000030   backupd-help
06:33:52  getattrlist       /Volumes/FOOBAR  0.000017   fontworker
06:34:15  getattrlist       /Volumes/FOOBAR  0.000020   fontworker
06:34:48  getattrlist       /Volumes/FOOBAR  0.000014   fontworker
06:36:23  fsgetpath         /Volumes/FOOBAR  0.000012   revisiond
06:36:23  fsctl             /Volumes/FOOBAR  0.000010   revisiond
06:36:23  getattrlist       /Volumes/FOOBAR  0.000023   revisiond
06:36:23  statfs64          /Volumes/FOOBAR  0.000011   revisiond
06:36:23  lstat64           /Volumes/FOOBAR  0.000010   revisiond
06:36:23  lstat64           /Volumes/FOOBAR  0.000008   revisiond
06:36:23  statfs64          /Volumes/FOOBAR  0.000007   revisiond
06:36:23  getattrlist       /Volumes/FOOBAR  0.000012   deleted
06:36:23  statfs64          /Volumes/FOOBAR  0.000005   deleted
06:36:23  lstat64           /Volumes/FOOBAR  0.000009   deleted
(...)
06:36:23  getattrlist       /Volumes/FOOBAR  0.000055   AOSHeartbeat
06:36:25  statfs64          /Volumes/FOOBAR  0.000006   df
06:36:30  HFS_update /Volumes/FOOBAR/..V100/../db.sqlite-wal launchd

I believe the best solution would be mounting and unmounting the drive to completely ensure no activity from the OS or any other rogue processes.


There is an already built solution that is paid: Following this guide can help with more advanced settings how to unmount and mount the drive.


A free Solution would be combining

Apple Script disk mounting with Time scheduling to execute script