12

The sysadmins at my company say that Linux is prone to getting nuked by a power outage. They say Windows machines always survive power outages but Linux boxes often become unrecoverable (ie you can no longer boot the machines). This came up because they told me the power company is shutting off power to our offices for a long period of time so the admins wanted me to shut down all the Linux boxes to which I alone have access before the outage.

I thought Linux was supposed to be robust?
My question, - is there some process I should be running to avoid my Linux boxes from getting nuked by a power outage?

6
  • 2
    Well, disregarding different OS problems, power outages affects any machine, simply because every process that is running stops to. It is always preferable to let the machine shut itself off, because then all processes are allowed to stop normally. Aug 22 '13 at 22:09
  • Doh, I know this. The question is whether Linux is more brittle than Windows for some reason, and if so, is there something I can do to increase its robustness (like forcing it to flush its disk cache more frequently somehow, for example). Aug 22 '13 at 22:22
  • 2
    My answer mas meant to be general and encompassing: no matter what you do, there is always a risk of something somewhere failing. If Linux is more brittle I leave it for those who can specifically answer. My personal experience (with Windows and with OSX) shown me that unless I was doing something I cared for the output (simulations, for instance), they bounced back easily. Maybe something you should add is how the machines are used. Aug 22 '13 at 22:26
  • "Is there some process I should be running to avoid my Linux boxes from getting nuked by a power outage?" The problem is at a hardware level, the only command you can run here that would help is "shutdown computer" If you are concerned about this, I recommend a UPS (though this gets expensive fast if you have a large number of computers)
    – David
    Aug 22 '13 at 22:32
  • 7
    Always is a big word, its also false. Windows can become corrupt during a power outage. Why don't you have battery backups and configure your system to shutdown? I can safely say that anyone who says "always" will be wrong 99.99999% of the time.
    – Ramhound
    Aug 22 '13 at 23:07
15

Is linux more brittle than windows?
The answer is : It Depends.

When someone says "unable to boot" in this situation I translate it to "File system corruption" and the answer Yes or No to the original question all depends on which file system you are using.

Windows does not let you have the full range of choices for filesystems that a Linux box will allow. You almost never see a non NTFS windows system. NTFS has things built in to it to help if there is a power loss, like journaling and file transactions that can roll back in the event of a failure.

A Linux box could have this, and could not. It all depends on how the server was set up. If the server used ext21 you could be very susceptible to file corruption in the event of a power failure. Compare that to a system that used something like Btrfs which has more data integrity features than NTFS does.

So if the sysadmin you where talking to only has ever worked with ext2 systems he very well could be right, but if you used another filesystem he could be wrong.


1: Ext2 was the default for both Debian and Red Hat Linux for a very long time. It has now been replaced mostly with Ext3 which is more on par with NTFS for features for data integrity.

6
  • What about the filesystems with journaling and file transactions that are not NTFS? I don't dispute the lack of complete and total power in Windows can lead to better stability if something is interrupted though.
    – Ramhound
    Aug 22 '13 at 23:10
  • 3
    I mention that in my note on the bottom, Ext3 is the same level as NTFS. I believe that the sysadmin may have only experenced Ext2 filesystems, and from his point of view he would be right. It is like if you where only exposed to Fat32 filesytems and had never seen NTFS you would feel similarly about windows (versions of Windows on Fat32 had a horrible history of file corruption on power loss) Aug 22 '13 at 23:13
  • I entirely missed the footnote :-(
    – Ramhound
    Aug 22 '13 at 23:15
  • +1 for referring to the different file systems in use and journaling. Aug 22 '13 at 23:32
  • Best answer here +1 Jul 29 '17 at 3:35
3

No, Linux is not inherently less robust then Windows when it comes to sudden power outages. What could happen - in the case of either OS - is that stuff is being written to the filesystem on the harddrive at the precise moment power is lost, and (historically) this could corrupt the filesystem.

The solution to this problem is to use a journaling filesystem which is immune to this problem based on the way it writes information. Most new filesystems - including Ext3 and ExT4 (the most common filesystems for Linux), as, I believe, NTFS is as well. So as long as you are using a journaling filesystem you won't experience this problem.

Later on down the boot process, if you have a database (I'm looking at MYSQL, Postgres does not suffer from this), you may have analogous issues with the MYSQL database - MYSQL is often not particularly robust (Google ACID compliance MYSQL for this topic). You can get around this problem by forcing a check of the indexes on reboot if your MySQL setup is not ACID compliant.

Another (somewhat Jaded and possibly unfair to Windows) view might be this - Linux boxes are more reliable then Windows boxes (as measured by Uptime and the need to do reboots) - thus it is possible that when Linux boxes fail on reboot it is a hardware problem due to old age rather then a software problem - whereas a failing Windows box may be detected sooner because of more frequent reboots)

2

Dependent on the distro and what file system you have, it could be more or less vulnerable. If you know about a scheduled power cut, you should definitely manually shut down (and use the time for maintenance like vacuuming the systems or maybe rewiring... For those unscheduled power outages, get UPS systems with Linux shutdown software so you don't need to worry. You should be running this anyway. There is a APCUPSD file available for most Linux distributions, if not that, then check with your distro to see what is already inside of it or available for it. Make sure it will shut down your systems cleanly prior to relying on it.

-8

I did some research on this question and I found that what my IT department is said is essentially correct, Linux is way more vulnerable than Windows to a power outage. The reason why is how the inode table works in Linux/unix. Since it is an unordered list and is constantly being modified, there is no separation between important, static files like kernel binaries, and worthless files like temporary files. What this means is that the inode entries to critical system files are constantly being re-written, a very bad design obviously. In fact, critical system files are actually more likely to be having their inode entries be written at any given time than non-essential files. When power goes out it tends to blow away whatever part of the inode table was being written, which likely as not contains pointers to system files. The system files themselves are fine and intact, but the directory to find them is damaged. The situation is made worse by disk caching which has the effect of increasing the size of the damaged areas of the inode table.

In Windows, even the old FAT file system is way more robust than this. FAT has a table too, but it is an ordered table, so it does not have system files mixed up with temporary files. Usually the system files are in one area of the directory all together and this area is unlikely to be written very often. Also, FAT has a backup directory, so even if the directory is corrupted, it just reverts to the backup. This means that with FAT the user is unlikely to lose any file links in the event of a power failure, even temporary files. With Linux, however, since the inode table is constantly being written, the user is virtually guaranteed to lose access to files in a power failure.

The only thing that can be done to mitigate this is to turn off disk caching.

As evidence that linux systems often die on power outages, you can simply do web searches and bring up hundreds of hits like these:

https://forums.linuxmint.com/viewtopic.php?t=232793 (2016) https://askubuntu.com/questions/813864/ubuntu-16-04-wont-boot-after-power-outage-efi (2016) https://forums.linuxmint.com/viewtopic.php?t=295491 (2019) https://askubuntu.com/questions/1107318/ubuntu-is-unable-to-boot-up-after-sudden-power-outage (2019)

etc. These are all recent posts, so I am sure none of them are using old technology like ext2.

4
  • 2
    -1. Please support your claims with links, articles, sources etc. and I will revoke my downvote. What Linux filesystem(s) do you refer to? Apr 27 '17 at 14:03
  • Tyler - You did read the answer Scott Chamberlain posted on your question, right? Are you 100% certain that the way you explain these inode table storing pointers for Linux files including OS system files is the way this works for all current Linux file systems since you can pick more than just one as explained, & some do have these more robust file meta data inode/journaling/transaction controls than others including some that are more powerful than even NTFS as explained? Maybe you're systems or the one you wrote about is because of the use of an older Linux file system & thus choose wisely? Jul 29 '17 at 3:35
  • The main reason I find this answer—and the whole question—to be a joke is Linux/Unix powers the Internet, not Windows. If outages can blow away Linux/Unix systems so easily, the Internet would not be able to function. Additionally routers that use Linux would then be useless when they are routinely quickly powered on and off. Jul 27 '18 at 22:25
  • This answer isn't just bad; it's simply nonsense. None of the facts stated in this answer are even remotely accurate.
    – user89623
    Nov 4 '18 at 7:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.