Is the battery redundant if the server is on a properly-sized UPS? There is an option to force write-back mode and I want to understand the risk. It is my understanding that it helps against power failures while data in the cache has not been written out to physical disk. But if the server is on a UPS, then there is no risk of power loss, especially if it is a smart UPS and the server is configured to shut down gracefully when the battery reaches a low state. Am I missing something?
Your understanding is essentially correct.
Allowing the controller to cache write data in its local RAM improves write speed, however it exposes you to a risk of having the OS think data has been written to disk (because the controller has it) and having power fail before the controller completes that write. The battery back-up allows the data in the cache to survive until the machine is powered on again, mitigating that risk.
As far as benefit if your system is already on a UPS, what happens if you exceed your UPS runtime (possible even with a smart UPS), or if the server's power supplies blow up? Or if someone accidentally yanks the power cords out?
Many thing can cause a power failure. A UPS only protects against a few of them.
There are two reasons for the battery;
These are both good reasons but to be honest flash-based caches have taken over from battery backed ones recently for obvious reasons and I'd recommend them first - that said if you do a lot of writing I'd recommend one or the other over just a UPS.
The battery also enables the ability to have the improved performance as well as the purposes noted by voretaq7. Take the battery off and the device will still function but at substantially reduced speed.
If you have a UPS you can force the cache on and not use the batter on the raid. If you lose power without a raid card you can get corrupted data, thats what backups are for.
And just because you lost power does not mean your system is toast. The cache only holds 256 megs and it gets flushed/written to HD all the time when idle. Its not like it holds all the data and never lets go of it. Its always being flushed.
A meteor could hit the building and blow up everything, don't let these worry wort's get ya down. I've run raid 1 with cache on and no battery with no issues.
You can get really anal in this conversation. Why not have 4x fall over server, 10x backups etc etc. Its not that big a deal.
Turn the cache on use your UPS. If you have a ps blow you can get the data back and it would have to blow during work hours with someone using the computer and have the right application open, and saving data at same time etc etc. So the odds are low, and if it happens it can be fixed easily.