LinkStation Pro from a Mac: Wake On LAN

This is a case of a little knowledge getting me into trouble and then back out. If you have stumbled on this article it might possibly save you some time, or at least provide answers to questions that I struggled to find. Also, I don’t claim what I’ve done here to be elegant or even finished [I’m certainly not an Apple developer, in fact I haven’t written any code beyond the odd script for about 10 years and the world is undoubtedly a safer place :)]. But it does work. On with the story…

First the photography context for my buying the NAS unit: I recently purchased a Buffalo 2 Tb Linkstation Pro LS-WTGL/R1 because my manual, multi-hop back-up process was getting swamped. I was keeping two copies across the camera card, my mac, an external hard drive, and then finally DVD. If you bake editing and trimming of duff pictures into this, it rapidly turns into a mess. This is part of my motivation for getting into Lightroom for streamlining my workflow.

So the process was buckling under the load: for instance, I still haven’t sorted out my photos from Cuba. Of a more immediate concern is the fact that my external drive, a 1/4 Gig Maxtor OneTouch, has started to make a strange noise. It must be about 5 years old so it doesn’t owe me anything.

So last week I took the plunge and went through the Domestic Investment Governance process, and got blessing for the LinkStation, which I chose on the basis of a positive review in the Register [not the same model but near enough].

Out of the box I configured it as RAID 1 as the first step, and copied 50 gig of pictures over successfully on the first evening, which all worked fine with the default share configuration.

However, the night before last, I started getting some really odd errors errors when I was trying to do a similar sized copy: specifically, the finder was reporting an error code -36, which equates to the rather uninformative, and apparently quite common, catchall ‘I/O error’.

At this point I made the mother of all assumptions. When you configure your Mac for Windows file sharing as a server, you are sending incantations to Apple’s Samba implementation. Samba is something that I have used a lot, and administered briefly, at work. Anyway, because the Mac works out of the box as a server, I assumed that it would be fine being a client. It isn’t, at least with the Samba implementation under the hood of the LinkStation box.

The simple answer is, of course, to press the ‘Apple’ button when you configure your share, which is turning on Apple’s own file sharing protocol, AFP. You then need to change the reference in the server connection configuration [in the Finder] from SMB:// to AFP://.

Simple of course, but undocumented. I get the feeling that the documentation is very much aimed at Windows users, where you don’t need to tinker as much.

On a related theme, the Mac software appears to be… dissapointing, in the non-functional sense of the word. The back-up scheduling software [Memeo] hung when I tried to configure it. I tried installing it twice, and have given up on it. No disrepect intended to whoever develops the software, I’m sure I was doing something wrong. To be honest I didn’t really persevere, as I intend to use the RAID 1 storage as a ‘top copy’, with occasional manual backup to DVD.

What was more irksome was the Mac specific power management capability, when you set the power switch to ‘auto’. The manual says that you ‘…must have the Nas Navigator software installed on your PC for this feature to work”.

And sure enough, the Mac version doesn’t wake up the unit.

Because this is sending a ‘wake on LAN’ instruction I did a bit of googling to see if there were any little utilities that you could point at a given network device to tickle it into wakefulness. I didn’t find any.

What I did find was a piece of open source code which works perfectly. Usual caveats apply: if you are not comfortable putting this code on your machine, don’t. Anyway, it compiles an absolute treat. Just download the full install [not the diff] and then:

  • open the tar file in the finder to expand;
  • open a terminal window and change into the directory; [all of the following are commands, comments in brackets]
  • ./configure
  • make
  • sudo make install [you will be asked for the admin password]

This will then put the resulting executable ‘wol’ into /usr/local/bin. Next you need to grab the MAC address of your LinkStation. Again in your terminal window, type

  • arp -a

which will give you a list of results, including a line indicating the name of the NAS box which is set during the initial configuration, and the MAC address, which is the list of colon separated Hex characters.

The Linkstation is listening on port 9 [one of the standard UDP ports apparently], so firing a command like:

  • /usr/local/bin/wol -p 9 0:1d:63:19:b7:32

will wake up the  box. One instance should do it, but I’ve turned this into a little AppleScript which calls the command 3 times:

repeat 3 times

do shell script “/usr/local/bin/wol -p 9 0:1d:63:19:b7:32”

delay 1

end repeat

which I have saved on my desktop. After executing the command, it takes about a minute or so for the LinkStation to pull itself back onto the network. The next part I haven’t had a chance to play with fully, as I only got this working pretty late last night.

Articles I’ve found online suggest that the disk will go back to sleep after 5 minutes of non-use. It would be simple to move the entire loop in the script above to a shell script, add a 4 minute delay, and then run it in the background by using:

do shell script "command &> file_path &"

which is explained fully here. However, if it’s not easy to stop the process you might as well not use the ‘auto’ power-save, so this is a pretty inelegant mechanism.

It’s a shame that it doesn’t seem to be possible to configure the idle time on the LinkStation.

I’ll come back to this when I have a bit more time…

2 thoughts on “LinkStation Pro from a Mac: Wake On LAN

  1. Actually a simple alternative to running a script in the background is simply to run the Applescript in an infinite loop like:
    do shell script “/usr/local/bin/wol -p 9 0:1d:63:19:b7:32″
    delay 120
    end repeat

    and then to exit it when you are done.

  2. The above is a little too simple. It’s not possible to stop the script’s infinite loop without a ‘force quit’. This works fine:
    on idle
    do shell script “/usr/local/bin/wol -p 9 0:1d:63:19:b7:32″
    delay 120
    end idle
    which needs to be saved as a ‘stay open’ application.

Comments are closed.