Linux vulnerable to corruption in power outage?
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?
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.
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)
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.