News for hackers. Stuff that matters.
Re:How we built a Smart Office system based on Raspberry Pi by rcaught on Sunday October 23, 2016 @12:02AM (#12771872)
Are you suggesting that they will reach the flash memory's write cycle limit within a year? Or something else here?

Also, I would not have thought that random power off events would affect modern file systems as poorly as you're suggesting.

Interesting thoughts though.

Re:How we built a Smart Office system based on Raspberry Pi by analog31 on Sunday October 23, 2016 @12:20AM (#12771931)
There's something else. The RPi is prone to failure if it's writing to the SD card when power goes down. Articles that I've read suggest moving most of the RPi's files to some other form of storage, for instance:

https://learn.adafruit.com/external-drive-as-raspberry-pi-ro...

I've thought about the idea of having some super-capacitor based temporary power storage, and an interrupt that triggers a graceful shutdown if the power input goes down. I think it could be done with fairly basic circuitry.

Re:How we built a Smart Office system based on Raspberry Pi by shabble on Sunday October 23, 2016 @10:19AM (#12773662)
such things exist (such as the pico from http://pimodules.com/) but I've had nothing but grief from its firmware using v1 and v2. There appears to be a new version, and I suppose it might be better now.

For most <1 day outages, a simple USB power-bank with passthrough capability (output whilst also possibly charging) will happily keep the pi going, but without some frankenbodging there's no 'power lost' signal that the pi can sense. I've idly toyed with the idea of a phototransistor on the powerbank status LED and an attiny or something.

Now that I think about it, there was someone trying to make a supercap idea, but I don't think it went anywhere: https://www.indiegogo.com/projects/juice4halt-supercapacitor...

Re:How we built a Smart Office system based on Raspberry Pi by mountaineer22 on Sunday October 23, 2016 @11:59AM (#12774029)
Could you not simply have a 5V DC power adapter on the same mains line, and detect if it is on or off via one of the GPIO pins? Is that considered frankenbodging?
Re:How we built a Smart Office system based on Raspberry Pi by analog31 on Sunday October 23, 2016 @02:27PM (#12774706)
That's what I would do. The loss of 5 V on the GPIO pin triggers a interrupt, which forces a graceful shutdown. As I understand it, there's a command which halts disk access, which is mainly what's needed for a graceful shutdown.
Re:How we built a Smart Office system based on Raspberry Pi by washadjeffmad on Sunday October 23, 2016 @05:23PM (#12775497)
You can use "systemctl poweroff", /sbin/shutdown, "shutdown -Ph now" (in case of wonky ACPI), and a few others to gracefully halt.

You can also echo a magic sysrq key (eg-"b") to /proc/sysrq-trigger. "e i s u o" would do the full graceful shutdown. This nicely asks processes to quit, kills (almost) everything, halts the system, syncs disks, and remounts fs ro before going down.

Or you could create a service with systemd to (run a script to) check when dbus gets a particular signal, like a network device being added or removed if an SSID disappearing was your indicator of power loss, then halt.

I'd probably just plug them into a UPS, though. Just have it send one of the shutdowns to the "master" when running battery power for longer than a few minutes.

Re:How we built a Smart Office system based on Raspberry Pi by Dylan16807 on Sunday October 23, 2016 @02:18AM (#12772268)
A small lithium ion with a sub-dollar charger/regulator is probably cheaper than a supercap.
Re:How we built a Smart Office system based on Raspberry Pi by arjie on Sunday October 23, 2016 @02:58AM (#12772367)
If you lose power on an RPi, it'll sometimes put everything in a state where it won't boot again. I've had this happen often enough at my parents' place in India (the power goes out unpredictably there) that I just imaged a bunch of SD cards and left them there so they can just swap it out when the time comes.
Re:How we built a Smart Office system based on Raspberry Pi by michus on Sunday October 23, 2016 @06:20AM (#12772859)
I am running a Raspberry Pi hosted web server for almost 4 years now. I only changed hardware to newer Raspberry Pi and bigger SD card after first 2 years. Never had any issues, never had to buy new SD card, its still up and running 24/7.
Re:How we built a Smart Office system based on Raspberry Pi by arjie on Sunday October 23, 2016 @02:04PM (#12774607)
Well, if you've never had power interruptions, that's what I'd expect. It's the interruptions.
Re:How we built a Smart Office system based on Raspberry Pi by dhon_ on Sunday October 23, 2016 @04:49AM (#12772633)
Interesting, are they mounting the SD card read only?
Re:How we built a Smart Office system based on Raspberry Pi by arjie on Sunday October 23, 2016 @02:07PM (#12774621)
No. I should have, but there was some reason I didn't and I didn't spend the time to figure out how to do the thing I wanted to.

Unfortunately, it's been over a year.

Re:How we built a Smart Office system based on Raspberry Pi by stbtrax on Sunday October 23, 2016 @02:27AM (#12772292)
This does happen, I've had it happen on a product I developed based on a SBC and a non commercial SD card. They make special SD cards for this reason.
Re:How we built a Smart Office system based on Raspberry Pi by panosv on Sunday October 23, 2016 @10:06AM (#12773607)
Can you share any pointers on the special SD Cards? Brands? Models?