Home Photo Server, Part 4: Battery Backup


One of the problems that I have with a local server is that we frequently have power “blips”. I don’t want to say outages, because the power is on about 99% of the time. The issue that we have is occasional “brown outs” where the power dips, but doesn’t drop out about once a month. We also have noticed about every other week it seems that the power will blink for just a moment.

Usually about three or four times a year the power will actually go out for more than an hour. It’s not uncommon for a minute long outage on a regular basis though. The worst outage we had was about 3 years ago, when the power was out at our house for 4 days! It was winter time, and I had to run the generator to keep the boiler going. Needless to say, we are prepared around here for the power to go out.

And that’s why I wanted my computer to be prepared as well. Anytime you are using something as a server that you want to make sure it is still running, you really should have it on a backup. So, I purchased an APC BackUPS 1350. By the specs, and it’s own digital display, it should keep my server and monitor running for 15 minutes during an outage.

That’s handy, but I wanted to take it one step further. I’m at work during the week day, and at church on Sunday, so I may not be around when the power goes out. If that happens, having it run for 15 minutes and then die really didn’t help me much. Fortunately, I found some great articles, and installed apcaccess to help me automatically control everything. First I added the EPEL repository, and then installed apcaccess:

# yum install epel-release

# yum install apcupsd

Then I navigated to the apc directory to change my settings…

# cd /etc/apcupsd/

# nano apcupsd.conf

This is a bit lengthy, but here is my apcupsd.conf file, without all the comment lines:

## apcupsd.conf v1.1 ##
# for apcupsd release 3.14.14 (31 May 2016) – redhat
# “apcupsd” POSIX config file

# Note that the apcupsd daemon must be restarted in order for changes to
# this configuration file to become active.

# ========= General configuration parameters ============

LOCKFILE /var/lock
SCRIPTDIR /etc/apcupsd
PWRFAILDIR /etc/apcupsd
# ======== Configuration parameters used during power failures ==========
NOLOGON disable
# ==== Configuration statements for Network Information Server ====
EVENTSFILE /var/log/apcupsd.events
# ========== Configuration statements used if sharing =============
# a UPS with more than one machine
UPSCLASS standalone
UPSMODE disable
# ===== Configuration statements to control apcupsd system logging ========
STATFILE /var/log/apcupsd.status
# ========== Configuration statements used in updating the UPS EPROM =========

The important parts being that I set MINUTES to 5, meaning that if the UPS believes that it only has 5 minutes of power left at the current usage rate, it will initiate a computer shutdown command to the server computer. Likewise, if the BATTERYLEVEL drops below 20%, it will also initiate a shutdown command (which, theoretically, would be the 3 minute mark). I suppose you don’t have to set both, but I wanted to make sure under either condition, it shut down the server computer gracefully.

A really funny parameter is NETSERVER on and NISIP At first I turned these off, but then found that the USB connection to the UPS didn’t work unless they were on and set to the local interface. So be sure you turn those on if you are using one of these as well.

Be sure to start the service and make sure it’s enabled:

# systemctl stop apcupsd
# systemctl start apcupsd
# systemctl enable apcupsd

After all of that, now I can just type apcaccess to see the UPS status:

APC : 001,036,0880
DATE : 2019-07-01 09:13:37 -0800
HOSTNAME : localhost.localdomain
VERSION : 3.14.14 (31 May 2016) redhat
UPSMODE : Stand Alone
STARTTIME: 2019-06-27 14:34:23 -0800
MODEL : Back-UPS NS 1350M2
LINEV : 121.0 Volts
LOADPCT : 34.0 Percent
BCHARGE : 100.0 Percent
TIMELEFT : 16.3 Minutes
MBATTCHG : 20 Percent
MINTIMEL : 5 Minutes
MAXTIME : 0 Seconds
SENSE : Medium
LOTRANS : 88.0 Volts
HITRANS : 139.0 Volts
ALARMDEL : No alarm
BATTV : 27.3 Volts
LASTXFER : No transfers since turnon
TONBATT : 0 Seconds
CUMONBATT: 0 Seconds
STATFLAG : 0x05000008
SERIALNO : 3B1907X23168
BATTDATE : 2019-02-13
NOMINV : 120 Volts
NOMBATTV : 24.0 Volts
NOMPOWER : 810 Watts
FIRMWARE : 954.e3 .D USB FW:e3
END APC : 2019-07-01 09:14:06 -0800

I might play with the high/low transfer, it seems a bit to wide of a spectrum to me, but we’ll see how it does. Either way, I feel a lot safer now in terms of power problems for my server.

Linux – keep it simple.

Battery trouble!

A friend of mine recently called me up with a battery problem. He had done some troubleshooting on his own, and already come to the right conclusion, but he wanted a second opinion.

His Galaxy S5 Active had a strange issue: if he unplugged his phone, it would reboot or die even though he had over 70% battery left. However, of he put his phone in power saving mode, it would work like it was supposed to. If the phone was plugged in, he could use it all day. So he figured that he needed a new battery, and he was right.

Lithium ion batteries have to meet a special safety standard, and from what I understand, that means that they have a special charging and discharging protection circuit. Here is a little except about it from http://batteryuniversity.com, where you can read all about it:

“Further layers of safeguards are solid-state switches that measure the current and voltage and disconnect the circuit if the values are too high. The protection circuits of Li-ion work on this on/off basis. (See BU-304b: Making Lithium-ion Safe.) All switching devices have a residual resistance that causes a slight increase in overall battery resistance and a subsequent voltage drop.”
In any event, of you have a cell phone battery that performs as normal, but once reaching a certain percentage above 0 it does suddenly or randomly reboots, then most likely this circuitry in the battery has failed. It is easy to think there may be another problem, say with the phone, because the battery still holds a charge. As for my friend, a new battery had him up and running in no time flat.

I recently purchased a new battery for my note edge, not because of this issue, but because the battery did not hold a charge for as long as I thought it should. Turns out I was correct. They say a cell phone battery is only good for 3 years, and that includes the time on the shelf before you started using it. It will last a long time, but performance will diminish over time.

Here what I bought (and no, this is not some sort of kickback add):

Samsung 3000mah Battery for Samsung Galaxy Note Edge – Non-Retail Packaging – https://www.amazon.com/dp/B00RYS9UIY/ref=cm_sw_r_other_apap_Yhn2fEg4qCmPC

It was only $12, and took about 3 minutes to replace because I stopped to take a picture (which takes a while when your usual camera is the phone you are working on). If you have had a phone for more than three years, I highly recommend a new battery. The difference was immediately noticeable!

Linux – keep it simple.