Terastation autorestart

The Terastation offers a mode that allows to automatically restarts after a power outage (e.g. when the power comes back). But this mode is disabled by default, and can be only enabled if directly connect a UPS via the serial or the USB port. The UPS must be APC or OMRON products.

It an be interesting to know how to set the "recover mode" even if not connecting an UPS.

Root acces is mandatory (not available by default).

Method
Make the proc driver interface writtable:

root@terastation> chmod 666 /proc/buffalo/ups/ups_recover

Then set any value to activate ("apc_on", "omron_on", "usb_on"), or "off" to deactivate:

root@terastation> echo "apc_on" > /proc/buffalo/ups/ups_recover

Internal behavior
Buffalo Linux kernel includes a driver to interface the ups_recover "proc" to a DS1339 chip. This chip is a RTC. It has a timer functionality. When setting the "ups_recover" file to "apc_on", for example, the kernel set a timer to occurs 2mn(?) after power outage (it seem to start once and not 2mn after power comes back). When the power comes back, the timer begins, and starts the Terastation. I didn't find why there is different possible values to set to the driver.

This mechanism is handled by apcupsd and omronupsd daemon that were patched by Buffalo (the sources are available on there web site, but for recent Terastation: XL models). The patched code, do access to the ups_recover "proc" file.

Reference
This has been checked on a Terastation Pro II Rack (TS-RITGL/R5) patched for root access