Safe poweroff
#1
Hi folks!

I'm running OpenWrt on a A64+. "Poweroff" in terminal on the device results in a reboot. It's OpenWrt related. That means, whenever I want to power off, I simply pull the plug, which leads to dirty flag set on the SD card (ext4).

So here is my question:

Is there any difference between pull the plug..or..hold down the power button for several seconds until it cuts out? Will the dirty flag also be set with that procedure?

The power button is not yet installed and I would guess there is no routine implemented in OpenWrt to "poweroff" the device safely with just a tap on the button.
I know a router is intended to run 24/7, so it's not a big deal. I'm just interested if there is a difference in the procedures.
  Reply
#2
I'm not terribly familiar with Linux and not at all with the A64+. But I'm pretty sure the power button won't help you if `poweroff` doesn't. Can you`shutdown now` ? If that works, I expect it would cause an orderly shutdown and halt the system without rebooting. At that point you could disconnect the power.

Do you have an option to use journaling? I don't know if that's ideal in your situation but it might be safer if you can't achieve an orderly shutdown.
  Reply
#3
Thank you for the answer.

I tried "shutdown now" but doesn't work. "Journaling" was a good keyword and I read a bit about ext4, what uses it already. So it seems that it's unlikely that the data itself gets corrupted by pulling the plug. The dirty flag is more a "beauty fault" if you will.
Since everything is configured properly, I will not power off the device that much anymore. So this already fits.

Regards, guenther
  Reply
#4
I guess I'd be inclined to use `poweroff` anyway, and only disconnect the power during early boot, before the root filesystem is mounted. That is the safest thing to do.

My limited experience with journaled filesystems in Linux is that they still require serious manual intervention to walk the journal at boot, when the dirty flag is set. (This is a nightmare when you're running "headless" with no way to connect a terminal that early in the boot process).
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)