We have occasional power outages in our environment which seems to cause data corruption on our Ubuntu machines with ext4 filesystems.
To my understanding ext4's default is to use
data=ordered
Which is described as "All data are forced directly out to the main file system prior to its metadata being committed to the journal."
Does this mean that if there is a power outage, and the operation to write to disk is interrupted that there can be filesystem corruption?
If I want to completely eliminate filesystem corruption due to power outages I'd guess I would use data=journaled
, are there any negative impacts to this other than a performance hit?
Bonus: How do I change the journaling type on my filesystem from data=ordered
to another. I'm guessing I'd need to make modifications to the journal but I'm not quite sure how or in what order to perform these operations.
It's just getting really annoying that Ubuntu (initramfs) doesn't have any filesystem recovery utilities so any way we can get to prevent us from having to pop in a live cd is great.
My /etc/fstab
# /etc/fstab: static file system information. # # Use 'blkid -o value -s UUID' to print the universally unique identifier # for a device; this may be used with UUID= as a more robust way to name # devices that works even if disks are added and removed. See fstab(5). # # proc /proc proc defaults 0 0 # / was on /dev/sda1 during installation UUID=9cd71f51-53bb-44c7-affa-14293e59d596 / ext4 errors=remount-ro 0 1 # swap was on /dev/sda5 during installation UUID=5568cee1-a50b-4409-ad67-cdc5bfb592a3 none swap sw 0 0 /dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
OS version
-bash-4.0# uname -a Linux LG-F3-19 2.6.31-14-server #48-Ubuntu SMP Fri Oct 16 15:07:34 UTC 2009 x86_64 GNU/Linux -bash-4.0# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 9.10 Release: 9.10 Codename: karmic
Image of failure: https://i.stack.imgur.com/BMtlZ.jpg
References: https://www.kernel.org/doc/Documentation/filesystems/ext4.txt http://www.ibm.com/developerworks/library/l-journaling-filesystems/
/forcefsck
in your root filesystem; this should be a text file containing just-y
. That forcesfsck -y
to be run on the root fs (before it is remounted rw) no matter what. Adds a bit of time to the boot, but should save the hassle of using a live CD if there's an issue. It seems odd that the pattern is your kernel and initramfs are OK, but then there's something else that goes wrong? You haven't actually described the nature of the "corruption" or how you come to this conclusion.fsck
. It works on debian and ubuntu systems; although I don't have 9.10 system to check, you should find a reference to it withgrep forcefsck /etc/init/mountall.conf
. It also gets deleted every boot, so if you want to make it permanent, you need to add something to a start-up service/script to put it back there (you want it there from the beginning in case the power is killed, etc).