4 ms·
from the article: > Powering down the Pi If you want, and you still have WiFi enabled, or the Pi is otherwise connected to your network, you can log into it v
by walrus01 6y ago
from the article:
> Powering down the Pi
If you want, and you still have WiFi enabled, or the Pi is otherwise connected to your network, you can log into it via SSH and run sudo shutdown now to power it off cleanly.
But I like living on the edge... it's not like the thing is writing a ton of data to the microSD card. When I'm finished using it as a webcam, I just unplug it. Simple as that.
If, for some strange reason, it did end up getting corrupted, I could just re-run this automation to set it up again. No big deal! I haven't had that happen yet, though.
################
If you want to do this you can tune ext4fs to flush writes to disk more often, which does have a small impact on disk performance (a moot point on something using a microsd card for a / partition, really, and on the anemic cpu performance of a pi zero w).
if you google "ext4fs power loss flush writes" you'll find some other references to making an ext4 system slightly more resilient to being abruptly powered off.
https://lwn.net/Articles/322823/ https://lwn.net/Articles/322823/
One possible solution is, of course, to just run ext3. Another is to shorten the system's writeback time, which is stored in a couple of sysctl variables:
/proc/sys/vm/dirty_expire_centisecs
/proc/sys/vm/dirty_writeback_centisecs
The first of these variables (dirty_expire_centiseconds) controls how long written data can sit in the page cache before it's considered "expired" and queued to be written to disk; it defaults to 30 seconds. The value of dirty_writeback_centiseconds (5 seconds, default) controls how often the pdflush process wakes up to actually flush expired data to disk. Lowering these values will cause the system to flush data to disk more aggressively, with a cost in the form of reduced performance.
- fuzzy2 6y agoI think a readonly root + tmpfs overlay is a better solution. Like live Linux, but without squashfs. It would also greatly prolong SD card life.