Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Backstory:

Since running 12.04 LTS, my computer has experienced two sudden losses of power; one due to my ham-fisted attempt to reboot and one due to a battery-less power cable disconnection. Both times there were booting problems directly after that the automatic fsck could not fix. I reinstalled after the first boot error and that fixed the problem but the second time I decided to try to figure out what the actual problem was. I learned a lot by messing around with the hard drive and OS trying to figure out what the heck was wrong but the two year old hard drive was unable to survive any more abuse and kicked the bucket before I found an answer. I have purchased a replacement but I am still looking for an autopsy and a way to prevent this from happening in the future.

Questions:

  • What are some causes of boot problems after a sudden power off? The hard drive containing the OS not being properly unmounted? Could a forced shut down actually cause the hard drive itself to become confused? How does a forced shut down affect the journaling of an ext4 file system?
  • How can Ubuntu be configured to minimize damage from a sudden shut down? The obvious answer being "Don't shut down by holding the power button, stupid" and though I have found some alternate ways to force a misbehaving session to terminate, sudden shut downs are not always caused intentionally by the user. Running Ubuntu on a laptop also increases the chances of a less-than-graceful power off. If there are things within 12.04 (either OS settings or settings of the hard drive itself) that could be configured to minimize the damage, I would be grateful to be made aware of them.
share|improve this question

2 Answers 2

So to your first question: What are some causes of boot problems after a sudden power off?

At shutdown the OS mainly waits until all Apps are correctly shutdown, shuts down Services, saves settings etc. It's unlikely the whole machine will die after force shutting it down. If you have any DATA in the buffer then you will lose those. Think of it as things you need take with you every day. If you forget something you wont' die but will be unhappy.

Well there are many causes of boot problems but the most common ones are:

  1. Hardware failure. (Hard-disk, motherboard, RAM etc.)
  2. OS failure. (OS got disrupted)
  3. User (Sometimes the User messes with stuff he/she does not know of :P)
  4. Power loss (can be fatal, if you don't have the right power-supply your PC's gona have a hard )

To your second question: How can Ubuntu be configured to minimize damage from a sudden shut down?

In my experience a Backup Solution is always a good Idea. The thing is if your System freezes (And especially with Ubuntu that is a big IF) and you have to force shutdown the System, it should be no problem to recover with a Backup. But If your System crashes and you get a Hardware failure there is almost nothing you can do, except replace the broken part. :P

Here's a step by step how to Backup in Ubuntu:

Open System Settings:

System Settings

Click on Backup:

Backup

Here you can set up your Backed-up Folders, when to Backup, where to BNac and how long your Backup should be saved:

Backup Backup Backup Backup

share|improve this answer

The only means of preventing data loss on systems suffering from possible power failures is

Frequent Backups

But still there are some additional measures to minimize possible hard disk failures after a sudden power failure but these will be at cost of performance.

  • Disable write cache for the drive

    sudo hdparm -W 0 /dev/<sdX>
    
  • Make shure journaling is enabled on an ext4 file system (default behaviour)

  • Do not disable (default) write barriers when mounting

In case we are very familiar with the Ubuntu file system hierarchy we may also consider putting those system directories which do not need write access on a partition mounted real only. This will help to still have a booting system even if there was a file corruption elsewhere, but it will not prevent you from losing your personal data. In the case of a non-server system I do not recommend this because restoring a backup or even a reinstall will always be faster than getting a read-only system file hierarchy working stable.

Source and urther reading:

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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