Over the last week my area has received a lot of electrical storms, the most recent of which knocked out the power for a split second causing the UPS to fail over to battery power which saved me losing what I was working on. I’ve had this UPS for a few years now and it’s definitely been worth every dollar and then some, if you don’t already have one I suggest you look into investing in one.
Earlier this year I purchased a QNAP TS-870 8 bay NAS which is plugged into the CyberPower UPS as I don’t want to risk data corruption should the power go out. However when the UPS failed over to battery on the most recent instance, it made me consider what would happen if the power went out while I was not at home to safely shut things down. I run the NAS 24/7 so if the power went out for an extended period of time while I was out or asleep the NAS would almost certainly drain the battery of the UPS then shut off without correctly shutting down.
As the majority of my data is now stored on the NAS this would be an unacceptable option, so I have instead configured the NAS to safely shutdown when it detects that the UPS is using its battery.
Connecting the NAS and UPS together
After a little bit of research, I found out that I could resolve this problem by simply plugging in a USB cable between the UPS and the NAS. This allows the NAS to be able to detect when battery power is in use on the UPS and then shutdown appropriately based on the configuration I set.
These two images show the USB cable plugged in between the NAS and UPS via USB ports.
After connecting the two I received a pop up in the web GUI and the event was logged.
Configuring the NAS
This part will vary depending on your NAS manufacturer, OS and software versions, my QNAP NAS is running QTS 4.1.1 as of this post. For me after the previously mentioned pop up appeared I could click it to go right to the configuration, however you can get there through Control Panel > System Settings > External Device > UPS tab.
Once there you should hopefully see some information on the UPS, as in the image below I could see the UPS model as well as the battery remaining.
You can also specify the amount of minutes that the NAS should shut down after running on battery power, so in the case that the power does not turn back on.
Testing shutdown on powerloss
After it was all configured and looking good it was time to remove the power from the UPS and force it to fail over to battery power. Once the power was off the status of the UPS as shown in the NAS GUI changed to show that the state was now “Abnormal”, with an estimated amount of time and power left on the battery in the UPS.
While pulling the power from the UPS I started a timer to see if the NAS would actually begin shutting down after 5 minutes, it did not. I waited for almost 10 minutes and nothing happened, by that point the battery was getting quite low so I returned power to the UPS to investigate the problem further.
In the web GUI I had some warnings alerted as shown below.
I wasn’t able to find out much regarding these warnings, they appear to come up once the NAS detects that power has been lost. The strange thing here however was that many of them were reported every few minutes despite the UPS running on battery the entire time. It was almost as if every few minutes the UPS was returning that it was healthy and the NAS shutdown timer was starting over again as it never seems to have hit the 5 minute mark in the logs. This may explain why every time I log into the GUI I get the pop up message stating that an external device has been detected (the UPS), despite clicking “do not ask me again” every time.
I couldn’t find too much about this problem, so I lowered the “Turn off the server after the AC power fails for X minutes” from 5 minutes to 1 minute and tested again, it worked perfectly. The shutdown time took about 1-2 minutes, so make sure you factor how long it actually takes your NAS to power off into the overall time required so that you have enough battery power left to complete the task.
After some strange issues that still remain unknown I was unable to set the NAS to shutdown after running on battery power for 5 minutes. Lowering to 1 minute worked fine, which I’m happy with as I just want the NAS to shutdown in the event of a sustained power outage to ensure that my data is safe.