# UPS with FreeBSD 9.1



## luckylinux (Mar 31, 2013)

I own a server on which I plan to install FreeBSD 9.1 with ZFS.

Since this server stores all of my data and serves as NAS, I would like to avoid sudden shutdowns due to power outage. Even though I heard that ZFS can cope pretty well with power failures (if you have cache at least - which I don't), IMHO it'd be better not to rely on that alone.

Therefore I have to choose an UPS with good FreeBSD support in order to shut it down nicely in case power goes down for a long time.
I would like to put it in my (pseudo) 19'' rack in order to make better use of the space.

I was wondering if you could suggest me some UPS (with true sinewave output) with good FreeBSD support. Right now I was looking at:

APC SMX1500RMI2U (~ 920$) + Legacy card AP9620 (~ 60$)  
CyberPower Professional Series PR1500ELCDRT2U (~ 670$)
OPTI-UPS Durable Series DS1500B-RM (~ 720$)

These are about the only brands I can get around here (Europe). Another brand available is Online USV (German brand) but their rackmount UPS are kinda expensive.


I already owned a few APC UPSs (BackUPS Pro) and one failed on me (twice !). APC Support was very nice and a new unit was sent to me in less than 3 days.


That being said, APC support on GNU/Linux or FreeBSD seems to be lacking lately because of their Microlink protocol. Either I get an additionnal card (AP9620 or a Network Management card which is much more expensive), or I consider alternatives. There is a good availability of replacement batteries.

CyberPower offers their Powerpanel Linux version so there seem to be Linux support for their devices. Not sure if I could run it on FreeBSD in compatibility mode though. NUT doesn't seem to support [well] the PR* line of products (PR2200* is listed as "reverse engineered").

OPTI-UPS seem to offer "Double conversion" thus providing more filtering and a more stable voltage (see for instance here: http://www.tomshardware.com/reviews...00pfclcd-tripp-lite-smart1500slt,2785-12.html). This however heavily impacts on energy efficiency (even when there is no power outage). There is yet again a good availability of replacement batteries. Warranty only lasts 2 years though.


I personally would go with Cyberpower because of the lower price, but I'm still not sure about:

FreeBSD support
Batteries replacement (they claim they use "Universal" batteries that should be available at all major stores but who knows). Seems like OPTI-UPS and ONLINE USV have the same "Universal" battery policy
Batteries seem to last less than APC ones

Thanks to anybody willing to help me make a good choice.
If you need further information, please ask.


----------



## wblock@ (Mar 31, 2013)

Do not buy the APC SMX UPSs with their proprietary protocol.  That kind of anti-customer activity should be discouraged.

I have no experience with the other two brands.  Or rather, I've seen a few CyberPower units, but they were low-end home computer units.

I've had good results buying APC Smart-UPS units at excess equipment auctions, usually at  less than 5% of full price.  In every case, there was nothing wrong with them, just dead batteries.  All of these units use standard SLA batteries, available at battery supply places.  The "floor-standing" SUA1500's batteries are very easy to replace.  The rackmount version is more difficult, but still possible.  APC would be happy to sell you a replacement battery tray.  They may use a slightly better brand of standard SLA battery, although they do not seem to last as long as they did a few years ago.

APC units can also be bought as refurbished.  Shipping tends to be expensive due to the heavy batteries, but it's still less costly than buying new.

A patch is needed to get the current version to compile, but otherwise sysutils/apcupsd works well with the Smart-UPS.


----------



## luckylinux (Mar 31, 2013)

wblock@ said:
			
		

> Do not buy the APC SMX UPSs with their proprietary protocol.  That kind of anti-customer activity should be discouraged.


Couldn't agree more. There was one thread on APC forums which was 5 years old talking about their position of not supporting open source products anymore ...



			
				wblock@ said:
			
		

> I've had good results buying APC Smart-UPS units at excess equipment auctions, usually at  less than 5% of full price.  In every case, there was nothing wrong with them, just dead batteries.  All of these units use standard SLA batteries, available at battery supply places.  The "floor-standing" SUA1500's batteries are very easy to replace.  The rackmount version is more difficult, but still possible.  APC would be happy to sell you a replacement battery tray.  They may use a slightly better brand of standard SLA battery, although they do not seem to last as long as they did a few years ago.


Since when do APC use standard batteries? I have the BackUPS Pro 1500GI and that battery is all but standard. The position of the connection holes is not standard AFAIK. You can't just come with any battery and plug a cable in. The battery has to accept a connector which is on the "backplane".

However this may be an interesting option.
Since I'm powering a 3000$+ new server I would've preferred something more "high end". But what really sucks is that even if you pay more, you don't get better support for the OS you want to use.

Not so sure where to look for "excess equipment auctions" in my country though.
If I recall correctly, I read that the SUA series draw lots of power even at no load (kind of 1A from the mains) and it's kind of noisy. If possible the unit should be relatively quiet (at no-low load at least) and have a good efficiency.

Note: I'm looking into rackmountable UPSs because I have little space and the "rack" (basically a steel shelf) "only" supports 40-45kg per each shelf. Otherwise I may use the floor standing equipment. The latest high-end floor-stand APC units have the same problem as the SMX series though ...

An alternative may be the CyberPower UPS controlled by a GNU/Linux distribution from Virtualbox if the Linux compatibility mode doesn't work. That's more a workaround than a solution though.



			
				wblock@ said:
			
		

> APC units can also be bought as refurbished.  Shipping tends to be expensive due to the heavy batteries, but it's still less costly than buying new.


You have to ask directly to an APC representative in your country I suppose ...
I may try that too.



			
				wblock@ said:
			
		

> A patch is needed to get the current version to compile, but otherwise sysutils/apcupsd works well with the Smart-UPS.


Good to know, thanks.


----------



## wblock@ (Mar 31, 2013)

luckylinux said:
			
		

> Since when do APC use standard batteries? I have the BackUPS Pro 1500GI and that battery is all but standard. The position of the connection holes is not standard AFAIK. You can't just come with any battery and plug a cable in. The battery has to accept a connector which is on the "backplane".



The batteries inside the battery pack are standard.  I can't quickly find an online reference for how many batteries are in that RBC124 pack, some sites show two, some show six, some show eight.  But they are standard 12V, 7-9AH batteries.  The wiring from the dead battery pack is reused.  Sometimes the batteries are stuck together with double-sided foam tape.  That tape can be found at hobby shops, called "servo tape".

I don't know if APC sells refurb units.  There are online sites that do, though.

As far as auctions, in the US we typically have state, county, and school "excess equipment" auctions in the spring and fall.


----------



## luckylinux (Mar 31, 2013)

wblock@ said:
			
		

> As far as auctions, in the US we typically have state, county, and school "excess equipment" auctions in the spring and fall.


Thank you for your explanation.

Here as well sometimes they sell old equipment, although I think it's not that often (and not that big either) and not sure about which period of the year.

You can find something here on local auction sites (one unit at the time), although it more concerns smaller units (300-600 VA square wave output) and not that much interesting if you factor in shipping and the dead battery (~ 30-40% of the original price with a dead battery and shipping included).

So the only solution seems to be to buy old units if going with APC.
I'm not going to buy another card to make use of their UPSs!

At that point Cyberpower might become interesting. Not sure about FreeBSD support though (and that's about the only issue I see right now).

Any other options?


----------



## Terry_Kennedy (Apr 1, 2013)

luckylinux said:
			
		

> Couldn't agree more. There was one thread on APC forums which was 5 years old talking about their position of not supporting open source products anymore ...


And there are also repeated statements from APC employees along the lines of "I can't say anything more right now, but we should have a native sysutils/apcupsd-compatible solution soon", and then nothing further.



> Since when do APC use standard batteries? I have the BackUPS Pro 1500GI and that battery is all but standard. The position of the connection holes is not standard AFAIK. You can't just come with any battery and plug a cable in. The battery has to accept a connector which is on the "backplane".


They're standard batteries, but sometimes not the most common type (APC tends to use batteries with F2 terminals, while others use F1). Most APC replacement battery packs have multiple batteries stuck together or inside another housing. Generic replacements usually require re-using cables and housings (if used on that UPS model).



> Not so sure where to look for "excess equipment auctions" in my country though.
> If I recall correctly, I read that the SUA series draw lots of power even at no load (kind of 1A from the mains) and it's kind of noisy. If possible the unit should be relatively quiet (at no-low load at least) and have a good efficiency.


Newer APC units have improved battery charging circuitry (at least to the point where the UPS is less likely to overcharge and burst the batteries), but have been cost-reduced to an unacceptable (IMHO) level. The latest units are designed to last as long as the warranty and then be replaced. You can see this because APC no longer offers their "Charge-UPS" option, which was a replacement battery _and_ a warranty extension.

I've found a "happy medium" date range where the UPS has software-configurable battery voltage but isn't made so cheaply that it is disposable. I've been buying used models in the 2008-2009 range (the 2nd 2 characters in the serial number - for example, xx08xxxxxxxxx is a 2008 date code) on eBay that are sold as "without batteries" or "works fine, needs replacement batteries", and installing new batteries and adjusting the float voltage as described in the above link. Another useful utility APC would rather you didn't know about is APCFIX (Google translation from Russian).

I have some SUA1500's which are completely quiet except when actually on battery and don't have a high idle power draw. I believe the noise issue you mention is from one of APC's later cost-reduction moves - they apparently went "we have a fan in there already - if we run the fan all the time instead of only when running on battery, we can save all the money we've been spending on heat sinks", or something like that.

I've blogged about my various adventures in battery replacements and other repairs to APC units. Since I generally buy replacement batteries by the pallet-load (1500+ lbs), you may find those posts interesting.


----------



## luckylinux (Apr 1, 2013)

Terry_Kennedy said:
			
		

> Newer APC units have improved battery charging circuitry (at least to the point where the UPS is less likely to overcharge and burst the batteries), but have been cost-reduced to an unacceptable (IMHO) level. The latest units are designed to last as long as the warranty and then be replaced. You can see this because APC no longer offers their "Charge-UPS" option, which was a replacement battery _and_ a warranty extension.
> 
> I've found a "happy medium" date range where the UPS has software-configurable battery voltage but isn't made so cheaply that it is disposable. I've been buying used models in the 2008-2009 range (the 2nd 2 characters in the serial number - for example, xx08xxxxxxxxx is a 2008 date code) on eBay that are sold as "without batteries" or "works fine, needs replacement batteries", and installing new batteries and adjusting the float voltage as described in the above link. Another useful utility APC would rather you didn't know about is APCFIX (Google translation from Russian).
> 
> ...


Thank you for your answer. In my case I'm looking at something at a smaller scale :e

Can't find anything local nor on ebay at a good shipping price. These units are so heavy most of the time the shipping rate is just too expensive.

I wrote an email to Cyberpower asking them for FreeBSD support or if they tested their application in Linux compatibility mode. Let's see how that goes (though I don't get my hopes too high ...).


Last resort would be to design an UPS from scratch.
It may not be a technical problem for something basic, though I don't really have time for that right now ...
It may be cool to have a 100% opensource UPS though  (both software and hardware).


----------



## wblock@ (Apr 1, 2013)

The fans in both floor and rackmount SUA1500s are off until the unit switches to battery.  There is a little bit of transformer buzz, but I would guess most people would not even notice it.

For power overhead, I measured one of the rackmount units at 20W with no load.  Charging voltage was at exactly the reference level when I measured it.

Unless you routinely have long power outages, software is not really required.


----------



## luckylinux (Apr 1, 2013)

wblock@ said:
			
		

> The fans in both floor and rackmount SUA1500s are off until the unit switches to battery.  There is a little bit of transformer buzz, but I would guess most people would not even notice it.
> 
> For power overhead, I measured one of the rackmount units at 20W with no load.  Charging voltage was at exactly the reference level when I measured it.
> 
> Unless you routinely have long power outages, software is not really required.



I had *one *major power outage > 12h in 3 years.
No other power outage (except occasional undervoltage for < 5s each time).

When (not If, when!) it happens again I'd just like to be able to shutdown my NAS before battery runs dry and a ZFS pool crashes along the way, causing me to lose data.

Therefore software is necessary, at least to know if it's running on batteries (and how much time those still have).


----------



## luckylinux (Apr 3, 2013)

*UPDATE*

I just got reply from CyberPower systems for their UPS and my question about FreeBSD support. It seems that it should work. Here's their answer:



			
				&quot said:
			
		

> ...
> 
> I tried to inquiry about your email at our RnD department in Taiwan but the answer was that that the specific OS was NOT tested with our UPS models.
> Now you mention about the NUT support for some of our models, and althought the specific model is not listed, it uses the SAME protocol like the models that are listed as "compatible". Thus it will work! *We have S/W for Linux Support as you know, and FreeBSD is compatible with most Linux types, IT WILL work.*
> ...


Seems like it should work in Linux compatibility mode OR even with NUT. That's good news coming from the official support of an established UPS company. What puzzles me is that some Cyberpower UPS are indicated as "reverse engineered" in NUT compatibility list, though they say they work fine with it.


Alternatively I could buy a new APC SUA1500RMI2U @ ~ 750$ without needing a card adapter to extract informations from it (though it provides less plugs for other equipment: just 4 instead of 7-8 of the SMX model).
Another alternative would be the APC SC1500I @ ~ 450$ without needing a card adapter either. This would be the cheapest 1500VA solution, though it's a stepped sinewave aproximation and not a "true" sinewave.


As of right now I'm really getting interested in those Cyberpower units.

I'm waiting for other comments / opinions.
Thank you.


----------



## wblock@ (Apr 3, 2013)

The Cyberpower software is probably just a binary, while the reverse-engineered support would have figured out their communication protocol.  Reverse-engineered stuff is not necessarily worse; consider Samba.  I'd personally stick with the sinewave units.


----------



## luckylinux (Apr 3, 2013)

wblock@ said:
			
		

> Reverse-engineered stuff is not necessarily worse; consider Samba.


True. It's only a "grade" on which NUT categorized the compatible hardware on their site.
Rather than "Excellent/Good/Average/Mediocre compatibility" they decided to categorize them as "Excellent/Good/Average/No collaboration given by hardware manufacturer"

I can agree that the grade NUT gives to Cyberpower ("reverse engineered" for the most similar one - PR2200* - to the one I'm currently looking into) doesn't reflect the quality of compatibility with that hardware with NUT, but it's more representative of the support given by CyberPower to the opensource community. I can agree that an open source project likes to promote manufacturers which helps the opensource community the most.

As you said, Samba is the example of a very good product with zero support from the original software developer.



			
				wblock@ said:
			
		

> I'd personally stick with the sinewave units.


Which ones? APC's or you think that Cyberpower's are also worth a shot?

I always hear that APC units have always been reliable, they fail long after the batteries die (and those also last longer than other manufacturers'). Still I don't like their policy of Microlink protocol for new products and I can't get my hands on second-hand products.
I didn't hear much (yet) on Cyberpower units. 

I know I don't count in the statistic since I had 2 APC products (original and replacement unit) fail on me before 6 months of use (each). Though that was with consumer-grade UPSs units and not professional-grade.


Not sure if a "new" 750$ 2 generation old APC (SUA1500RMI2U) is still worth it. Would you reccomend it over the new Cyberpower's unit (PR1500ELCDRT2U)?
The APC also sells at 650$ but it may take a (very) long time to ship (and not sure if the one distributor selling it "that" low agrees to do that, since it doesn't have it in stock and may not like the trouble of getting it).
That would put it on par with the Cyberpower unit on price.
It would be only 2 years of warranty though (Cyberpower: 3 years).


----------



## wblock@ (Apr 3, 2013)

The (only two) reviews for the Cyberpower PR1500LCDRT2U on Newegg are very positive.  If it were me, I'd try to find some local datacenter guys to ask for opinions on Cyberpower, or about sources for APC units.

The availability of a communication protocol spec for the Cyberpower puts it above the APC SMX units for me.

What country are you in?  Someone may be able to suggest other sources.


----------



## Terry_Kennedy (Apr 4, 2013)

wblock@ said:
			
		

> The fans in both floor and rackmount SUA1500s are off until the unit switches to battery.  There is a little bit of transformer buzz, but I would guess most people would not even notice it.


Nope. APC changed this and didn't modify the model number or document it anywhere (or even tell their own support staff!). They took some heatsinks out and reduced the size of some others to reduce cost, and keep the fan on at a lower speed all the time to compensate.

Some discussion here. If it's important, I can track down the exact firmware revision where the change was made.



			
				luckylinux said:
			
		

> Seems like it should work in Linux compatibility mode OR even with NUT.


It probably will. Communication with the UPS is probably over a RS-232 or USB connection, and the software just has to open the appropriate device and do normal reads / writes on it. In my experience, there are 3 areas where FreeBSD's Linux emulation doesn't work with a Linux binary:


64-bit applications - FreeBSD's Linux emulation is 32-bit only, even on 64-bit systems.
Where a special device driver is needed and there's no emulation driver (like mfi_linux.ko) available. 
When the application uses system calls that aren't emulated (or aren't fully emulated) in FreeBSD.


----------



## wblock@ (Apr 4, 2013)

That's too bad about the fan.  With that and the proprietary protocols, maybe it's time for APC to lose their lead to a new competitor.  If Cyberpower documented their protocol, maybe it could be them.


----------



## luckylinux (Apr 4, 2013)

wblock@ said:
			
		

> If Cyberpower documented their protocol, maybe it could be them.


I don't think so since the unit was labeled "Reverse engineered" in the NUT compatibility list. 
At least they provide a software version for GNU/Linux which they claim to be compatible with FreeBSD.



			
				wblock@ said:
			
		

> What country are you in? Someone may be able to suggest other sources.


Switzerland. 



			
				Terry_Kennedy said:
			
		

> 64-bit applications - FreeBSD's Linux emulation is 32-bit only, even on 64-bit systems.


Are there plans for 64-bit compatibility mode in FreeBSD? The Powerpanel software is available in 32-bit and 64-bit versions anyway (for GNU/Linux).


----------



## Terry_Kennedy (Apr 4, 2013)

luckylinux said:
			
		

> Are there plans for 64-bit compatibility mode in FreeBSD? The Powerpanel software is available in 32-bit and 64-bit versions anyway (for GNU/Linux).


I don't know. Probably your best bet would be to ask on freebsd-emulation@

If Powerpanel is the management utility for the UPS, there's probably no benefit to having a 64-bit version - 64-bit binaries are generally slightly larger, and the main reason for having user-space 64-bit applications id for things that require lots (gigabytes) of memory. The FreeBSD kernel itself needs to be all-32-bit or all-64-bit, as you can't mix device drivers - they all need to match.

I took a quick look at pwrstatd from the Powerpanel distribution and on startup, it says:


			
				Powerpanel said:
			
		

> 2013/04/04 02:09:01 AM  The H2C device can't be used, because the linux system does not support libusb or libusb version is too old.


FreeBSD doesn't seem to have a Linux version of devel/libusb in ports, so you may need to download a Linux RPM and install it. [One thing that confuses a lot of users - in Linux emulation mode, you need Linux versions of all the libraries an application wants. Just because FreeBSD has /usr/lib/libusb.so natively doesn't mean that library will work in Linux emulation mode.


----------



## luckylinux (Apr 4, 2013)

Terry_Kennedy said:
			
		

> I don't know. Probably your best bet would be to ask on freebsd-emulation@
> 
> If Powerpanel is the management utility for the UPS, there's probably no benefit to having a 64-bit version - 64-bit binaries are generally slightly larger, and the main reason for having user-space 64-bit applications id for things that require lots (gigabytes) of memory. The FreeBSD kernel itself needs to be all-32-bit or all-64-bit, as you can't mix device drivers - they all need to match.


Yeah I knew that. I was just asking for other (more memory hungry) applications. Thanks.



			
				Terry_Kennedy said:
			
		

> I took a quick look at pwrstatd from the Powerpanel distribution and on startup, it says:
> 
> FreeBSD doesn't seem to have a Linux version of devel/libusb in ports, so you may need to download a Linux RPM and install it. [One thing that confuses a lot of users - in Linux emulation mode, you need Linux versions of all the libraries an application wants. Just because FreeBSD has /usr/lib/libusb.so natively doesn't mean that library will work in Linux emulation mode.



Thank you to have tested this. But installing all Linux libraries (on top of the FreeBSD ones) won't make a mess out of my system? I mean ... are Linux compatibility mode libraries installed in a reserved location in order to don't screw things up, right?

So even though they said the program should run fine, you think that may not be the full truth of the story?

Thank you.


----------



## wblock@ (Apr 4, 2013)

There is a separate tree for Linux stuff under /compat/linux.


----------



## luckylinux (Apr 4, 2013)

wblock@ said:
			
		

> There is a separate tree for Linux stuff under /compat/linux.



Good to know, thank you.

So you think if I install all Linux required libraries by the application, the Powerpanel should work correctly?


----------



## wblock@ (Apr 4, 2013)

Maybe it'll work, but I agree with the OpenBSD attitude about binaries, and would try sysutils/nut first.


----------



## luckylinux (Apr 5, 2013)

Thank you all for your replies.

I also found the "PR1500ELCD" (the freestanding equivalent of the "PR1500ELCDRT2U" as I understood it) for 100$ less (550$ instead of 650$). It seems to offer something less than the rackmount unit (mainly phone/DSL protection which is already provided by a low-end APC unit).

*The only thing left to protect would be the ethernet cable coming from my cable modem going into my Pfsense DIY router. Any suggestion for a ethernet surge protector (do they exist?) would be welcome.*


The height is JUST about right (with ~1cm to spare): I can put it on the floor, below the first shelf of my "rack".
Since I would have to buy 2 or 3 of those units, price is also a factor, though not the only one. They may all fit below my "rack".

In my place, would you prefer a neat rackmount version or the freestanding unit would just be as good? Battery capacity seems to be exactly the same.

EDIT: the rackmount unit features 4 x 7Ah @ 12V = 4 * 12 * 7 = 336Wh and provides SNMP/HTTP (included). The freestanding unit features 2 x 17Ah @ 12V = 2 * 17 * 12 = 408Wh (+ 20 %) but doesn't include SNMP/HTTP protocol, neither phone/DSL protection.


----------



## wblock@ (Apr 5, 2013)

The added battery capacity would be the draw.  On the APC units, the two big batteries in the floor-mount version are easily replaced.  The four smaller batteries in the rackmount unit are not meant to be user-replaced, they are glued in place with double-sided tape.

For me, apcupsd connected to the UPS via USB was more useful than the management cards.

I don't know of a standalone Ethernet surge protector.  The built-in surge protectors I've removed from UPS systems are just a few MOVs, which do not provide protection on every pair and degrade with every minor surge.  Something based on gas discharge tubes (GDT) would be preferable.  GDTs are cheap, it's the non-committal design literature on using them that put that project on hold.


----------



## luckylinux (Apr 5, 2013)

wblock@ said:
			
		

> The added battery capacity would be the draw.  On the APC units, the two big batteries in the floor-mount version are easily replaced.  The four smaller batteries in the rackmount unit are not meant to be user-replaced, they are glued in place with double-sided tape.
> 
> For me, apcupsd connected to the UPS via USB was more useful than the management cards.



I spoke all day long with a Cyberpower representative (the same that provided information about FreeBSD compatibility).
He suggested that the Freestanding unit was a better price / performance ratio.
Since I have some free place left on the floor and the advanced features of the rackmount version aren't much used anyway (that's what the Cyberpower support member told me) - much less for me anyway, I'll go with the  PR1500ELCD.
The battery compartment seems to be pretty flexible on that unit and 12V/17Ah batteries seem to be quite available around here.

I'll see whether it's also possible to fit 2x24Ah/12V in there


----------

