this post was submitted on 01 Jul 2024
4 points (75.0% liked)

Selfhosted

39919 readers
271 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

Setting up a Synology server, I made the mistake of just buying a UPS that had a USB plug on the back thinking oh this is a solved problem, it must just work. No no far from it.

So the UPS I mistakenly purchased is not compatible with Synology. SRV1KI-E wants to run this weird program called PowerChute.

Anyone have success marrying this into the Synology ecosystem?

It also has a RS 232 serial port, I wonder if there's an off-the-shelf device that would speak serial but output power state via the network or USB.

top 16 comments
sorted by: hot top controversial new old
[–] [email protected] 3 points 4 months ago* (last edited 4 months ago) (2 children)

I'll have to have a look when I'm next in the vacinity but I'm pretty sure I have an APC Easy UPS on mine and it works out of the box.

Let me get back to you...

Update: It's an APC Back-UPS 850. No doubt the instructions banged on about requiring Powerchute but I just plugged it into the Syno and it worked fine. You do need to enable UPS support on the NAS itself of course, from Control Panel/Hardware & Power/UPS, and set it to USB UPS.

[–] [email protected] 1 points 4 months ago* (last edited 4 months ago)

APC Back-UPS 850.

I'd guess that those maybe don't use the same protocol as an APC Easy UPS. There's a (widely-used) Linux software package, Network UPS Tools, which can talk to the APC UPSes that I've seen in the past.

https://networkupstools.org/stable-hcl.html

It has Back-UPS devices listed in the hardware compatibility list as well as devices from many other manufacturers, but I don't see any reference to an "Easy UPS".

[–] [email protected] 1 points 4 months ago

At this point, it might be easier just to buy a supported UPS. I'm glad the backups 850 is working. It's a good data point

I followed your advice, and went through the settings, and try to enable the USB device. But it's just not detected.

[–] [email protected] 2 points 4 months ago* (last edited 4 months ago) (1 children)

I'm assuming that your goal here is automatic shutdown when the UPS battery gets low so you don't actually have the NAS see unexpected power loss.

This isn't an answer to your question, but stepping back and getting a big-picture view: do you actually need a clean, automatic shutdown on your Synology server if the power goes out?

I'd assume that the filesystems that the things are set up to run are power-loss safe.

I'd also assume that there isn't server-side state that needs to be cleanly flushed prior to power loss.

Historically, UPSes providing a clean shutdown were important on personal computers for two reasons:

  • Some filesystems couldn't deal with power loss, could produce a corrupted filesystem. FAT, for example, or HFS on the Mac. That's not much of an issue today, and I can't imagine that a Synology NAS would be doing that unless you're explicitly choosing to use an old filesystem.

  • Some applications maintain state and when told to shut down, will dump it to disk. So maybe someone's writing a document in Microsoft Word and hasn't saved it for a long time, a few minutes will provide them time to save it (or the application to do an auto-save). Auto-save usually partially-mitigates this. I don't have a Synology system, but AFAIK, they don't run anything like that.

Like, I'd think that the NAS could probably survive a power loss just fine, even with an unclean shutdown.

If you have an attached desktop machine, maybe case #2 would apply, but I'd think that hooking the desktop up to the UPS and having it do a clean shutdown would address the issue -- I mean, the NAS can't force apps on computers using the NAS to dump state out to the NAS, so hooking the NAS up that way won't solve case #2 for any attached computers.

If all you want is more time before the NAS goes down uncleanly, you can just leave the USB and RS-232 connection out of the picture and let the UPS run until the battery is exhausted and then have the NAS go down uncleanly. Hell, that'd be preferable to an automated shutdown, as you'd get a bit more runtime before the thing goes down.

[–] [email protected] 2 points 4 months ago* (last edited 4 months ago) (1 children)

Right now when updates get applied to the NAS, if it gets powered off during the update window that would be really bad and inconvenient require manual intervention.

In memory caching, and the Amy cashing, well I think the file system would almost certainly be in a consistent state, you might lose data in flight if you're not careful.

The real problem, that I need an nas for, is not the loss of some data, it's when the storms hit and there's flooding, the power can go up and down and cycle quite rapidly. And that's really bad for sensitive hardware like hard disks. So I want the NAS to shut off when the power starts getting bad, and not turn on for a really long time but still turn on automatically when things stabilize

Because this device runs a bunch of VMs and containers as well closing down so that all of those rights get flushed is good practice

[–] [email protected] 2 points 4 months ago (1 children)

Right now when updates get applied to the NAS, if it gets powered off during the update window that would be really bad and inconvenient require manual intervention.

You sure? I mean, sure, it's possible; there are devices out there that can't deal with power loss during update. But others can: they'll typically have space for two firmware versions, write out the new version into the inactive slot, and only when the new version is committed to persistent storage, atomically activate it.

Last device I worked on functioned that way.

you might lose data in flight if you’re not careful.

That's the responsibility of the application if they rely on the data to be persistent at some point; they need to be written to deal with the fact that there may be in-flight data that doesn't make it to the disk if they intend to take other actions that depend on that fact; they'll need to call fsync() or whatever their OS has if they expect the data to be on-drive.

Normally, there will always a period where some data being written out is partial: the write() could complete after handing the data off to the OS's buffer cache. The local drive could complete because data's in its cache. The app could perform multiple write() calls, and the first could have completed without the second. With a NAS, the window might be a little bit longer than it otherwise would be, but something like a DBMS will do the fsync(); at any point, it'd be hypothetically possible for the OS to crash or power loss or something to happen.

The real problem, that I need an nas for, is not the loss of some data, it’s when the storms hit and there’s flooding, the power can go up and down and cycle quite rapidly. And that’s really bad for sensitive hardware like hard disks. So I want the NAS to shut off when the power starts getting bad, and not turn on for a really long time but still turn on automatically when things stabilize

Like I said in the above comment, you'll get that even without a clean shutdown; you'll actually get a bit more time if you don't do a clean shutdown.

Because this device runs a bunch of VMs and containers

Ah, okay, it's not just a file server? Fair enough -- then that brings the case #2 back up again, which I didn't expect to apply to the NAS itself.

[–] [email protected] 1 points 4 months ago

I was surprised too. But a lot of the current NAS devices basically operate as hosting devices. It makes sense the hard drives are there the power is there the RAM is there the CPU is there. So for the low intensity containers and VMs you want to run like a Plex server, or DNS server, or tail scale it's all right there

[–] [email protected] 2 points 4 months ago* (last edited 4 months ago)

Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread:

Fewer Letters More Letters
DNS Domain Name Service/System
NAS Network-Attached Storage
Plex Brand of media server package

3 acronyms in this thread; the most compressed thread commented on today has 5 acronyms.

[Thread #847 for this sub, first seen 3rd Jul 2024, 17:15] [FAQ] [Full list] [Contact] [Source code]

[–] [email protected] 1 points 4 months ago (2 children)

Well I'm ranting about this process, I have other complaints.

Synology.com - if you want to add a second factor to your account, requires a phone number to be the master factor, in case you lose your second factor. So if you're worried about Sim jacking, or even just not having a consistent phone number for the lifetime of the deployment, it's kind of a terrible practice. There's no way to unlink all phone numbers from an account, you can only replace them with a new phone number.

Synology does actually support hardware USB keys, but only as a secondary factor behind SMS... Ai ya.

[–] [email protected] 2 points 4 months ago (1 children)

So… I use a physical passkey as a second factor on top of username and password on all three of my Synology-boxes. I have TOTP as backup in case I should lose my passkey.

Anyways - synology has no clue about my phone number, so I’m not sure I agree with your sentiment that it’s a requirement.

[–] [email protected] 1 points 4 months ago (1 children)

The synology.com account, not the NAS account

[–] [email protected] 2 points 4 months ago

Ah! Misread your comment in that case.

[–] [email protected] 1 points 4 months ago (1 children)

AND their Synology drive client requires administrative permission to install on Mac OS, and on Windows. Why? Why.....

[–] [email protected] 2 points 4 months ago* (last edited 4 months ago) (1 children)

I'd guess that those OSes may not permit arbitrary software without administrative privileges to initiate shutdowns. That's the case on Linux.

[–] [email protected] 1 points 4 months ago (1 children)

Oh the synology drive is a file system syncing utility, it provides local caching of a remote file system and then syncs the files back. It's not the software that shuts down the computer

[–] [email protected] 1 points 4 months ago

To run a service outside the user context, probably.