Implications of AC power failure on suspended Linux box

6

My Linux box will be automatically shut down by the attached UPS if it is running and the AC power fails.

If I have the Linux box suspended and the AC power fails, I assume the UPS can not shut it down. What are the consequences of AC power failure on a suspended Linux system?

Organic Marble

Posted 2016-07-16T13:43:27.707

Reputation: 288

I'm not sure what your asking, there is nothing unique about Linux to this situation. Of course, it can't shutdown cleanly, it is suspended... but most Linux filesystems recovery nicely from a dirty shutdown, of course everything actively open that hasn't been committed to storage will be lost. Is that what your asking? And why suspend a desktop machine, just leave it on or shut it down is usually the better option. – acejavelin – 2016-07-16T13:56:19.260

I'm not asking if it's a good idea or for suggestions about how to operate my system. I'm asking if my system is suspended and the AC power fails, what happens to my system. – Organic Marble – 2016-07-16T14:32:26.423

I don't know about Linux, yet Windows usually enables hybrid sleep on desktops: it combines regular sleep and hibernation. If AC power failure occurred, the saved data will be read from disk – nothing is lost. From my experience at least, Windows is able to hibernate your computer if its battery runs flat while it's in sleep mode. – Alexey Ivanov – 2016-07-17T08:48:01.193

Answers

6

The same as a running system: fileystems are mounted, programs are running, files are open, data lingers in caches, etc. So you will have some data loss (whatever isn't saved), you may get a filesystem check upon start and possibly filesystem corruption.

JvO

Posted 2016-07-16T13:43:27.707

Reputation: 883

1This happened to me more than once now (battery exhaustion/disconnection while in sleep) with my x200s running Linux 4.x. Sometimes fsck manages to fix the error from the emergency mode, sometimes the filesystem just gets trashed irrecoverably. – Nemo – 2017-06-01T15:41:40.470

-2

It is possible for some files to get corrupted, but they will be restored if you check the hdd for errors using checkdisk. In rare cases you can get bad sectors. You should do whatever you can to avoid power failures.

user1318868

Posted 2016-07-16T13:43:27.707

Reputation: 1

1Checkdisk is a Windows thing, right? – Organic Marble – 2016-07-16T15:24:17.713

@OrganicMarble yes. The similar Linux tool is called fsck. – user1318868 – 2016-07-16T15:27:35.307