Need tighter connection with the Time Capsule as external drive

finderNetworktime-capsule

I am not familiar with the right jargong or semantics but will try to explain it as well as possible.

I have a Time Capsule which I use as an external drive to save media. I use a MacBook to access the data.

My problem is that my MacBook isn't always "fully" connected to my Time Capsule.

So what do I mean by fully connected? When I use Finder to access some file in the Time Capsule there is a considerable lag at first. So it is obvious that my computer is connecting or starting up the Time Capsule to browse its library of files.

Why is this a problem? I could live with the small lag, but the problem is that every time another drive is activated my Crashplan software search through all my drives to backup files. I really don't want this action activated this way.

Best Answer

Your Time Capsule has that "lag" because the drives spin down (goes to sleep) if there has been no activity for a certain amount of time.

This is also the reason that it gets disconnected after a certain amount of time. The drives go to sleep for two reasons: one, it's to save power; there's no point in spinning drives that aren't being used, and two it's to maximize the life of the drive.

I wouldn't recommend this method for sharing and/or storing files as the TC was meant for backups. If you need storage for your files I would definitely recommend a NAS like the Synology or an external Thunderbolt drive. I personally use the Synology with my Mac and have no problems whatsoever.

"Hack" to Keep the Drives Spinning

Since the drives spin down when there is no activity for a given amount of time, a quick and easy hack would be to access the drive for some minor operation to create activity. A simple bash script would work perfectly:

#!/bin/bash
# Script to create activity on time capsule to prevent drives going to sleep
# It creates an empty text file named tempfile.txt then removes it

touch /Volumes/<Time Capsule Volume Name/tempfile.txt
rm /Volumes/<Time Capsule Volume Name/tempfile.txt

exit

Save that bash script as keepalive.sh or something that makes sense to you in a easily accessible location like a "Scripts" subdirectory in your Documents folder. Make sure it has the "executable" attribute by issuing the command chmod +x keepalive.sh.

Now, using crontab you can easily set this script to run every X mins, hours, days, etc.

  1. Open crontab for editing by issuing the command crontab -e
  2. add the following line to your crontab file:

    */15 * * * * /bin/bash /Users/<username>/Documents/Scripts/keepalive.sh

  3. The time is set for every 15 minutes. If the lag is still present, you will need to adjust that value to something smaller. Just use crontab -e to edit.

NOTE: most likely your "editor" environment variable defaults to vi (default). It's not difficult to use, but it's definitely not intuitive for new users. Use nano instead by invoking the crontab editor with this command (pay attention to case):

env EDITOR=nano crontab -e

You will then be able to use Ctrl"Key" combinations (i.e. Ctrl"S" for "Save"). The commands will be at the bottom of the screen.