A little while ago I bought a LaCie 2big Network server to use for backups and storage. The drive is simple to use, but lacks the ability for the internal hard drives to "sleep" -- that is, spin down when not in use after a period of time. That's pretty annoying because the drive makes noise and wastes power while running, keeping the disks spinning. I decided I had to figure out a way to tame this little server.

The drive does have "shut down" and "wake on lan" features that are accessible from its web-based admin UI. When "shut down" the entire server turns off, becoming totally unaccessible. It can be "woken up" with a wake-on-lan request, however. With a little bit of scripting, I figured I could at least make the server sleep overnight, when I don't expect to be using it.

It turned out not to be that difficult to do. I dusted off my (very disused) Perl skills and created a Perl program that can log into the NAS and boss it around, as well as send the wake-on-lan request to it to bring it back from hibernation.

To make the NAS sleep, I just execute

twobig --host lacie-2big --credentials /etc/twobig.cred sleep

To make the NAS wake up, I just execute

twobig --host lacie-2big --credentials /etc/twobig.cred wake

The script even checks if there are any connected users (as reported by the NAS) when the "sleep" command runs, and won't shut the NAS down if there are.

I can also use the script to ping the NAS, with

twobig --host lacie-2big --credentials /etc/twobig.cred --timeout 90 ping

This can be combined with the "wake" command, so the script does not return until the NAS has actually finished booting up, which can take nearly 90 seconds in my experience:

twobig --host lacie-2big --credentials /etc/twobig.cred --timeout 90 wake ping

I plan to integrate this into an automount script so the NAS can be woken up automatically when needed.

The script can be obtained via anonymous CVS:

cvs -d :pserver:anonymous@msqr.us:/var/cvs co twobig