LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Guaranteed filesystem corruption on unclean shutdown? (https://www.linuxquestions.org/questions/linux-software-2/guaranteed-filesystem-corruption-on-unclean-shutdown-508814/)

pigsa 12-09-2006 07:30 AM

Guaranteed filesystem corruption on unclean shutdown?
 
In the recent year, I was been unable to cleanly shutdown the system 5 times. In 4 of the times, the filesystem is severely corrupted such that most, if not all, files (inodes technical) become unusable. The cases happened on different Linux distribution & different kernel versions

Case 1: Debian Unstable x86_64, 2.6.18 kernel (custom build)
The power was unplugged accidentally after the computer was idle for several hours.
Result: after running e2fsck and blindly answering 'y' on all questions, ALL files and directories are moved under /lost+found...
ls /lost+found was beautiful (with highlight based on file type) :)

Case 2: RHEL 4 x86, vmware, 2.6.9 (vendor build)
This was a high loading VM. Several minutes after telling it to do some memory intensive work (needs much swapping), I found that the VM was rebooting. I don't know why, but I guess it was caused by hangcheck timer.
Result: Ran e2fsck. After answering 'y' several times, I gave up. And then many files could not found (e.g., /sbin/shutdown, so that I need another unclean shutdown)

Case 3: Fedora Core 6 x86_64, 2.6.18 kernel (vendor build)
I was running 'badblocks' on a logical partition, and using 'pup' to update software. The system loading should be low. Suddenly the computer became unresponsive. All keys (including Alt-F?, CapLock, Ctrl+Alt+Del) have no effect. The harddisk light flashed for several hours (which must be much longer than the badblocks needed). Eventually, I pressed Reset
Result: ls some directories gives ext2 errors (forget to copy). ls some files gives IO errors. When running e2fsck, I noted that it says something like 'Root directory is not a directory. Fix?'

Case 4: Fresh reinstall of Fedora Core 6 x86_64, 2.6.18 kernel (vendor build)
Computer hangs after completing installation process. Presed Reset
Result: same as about

It seems ext3 (or e2fsck) is extremely intolerant about power failure. I know one is supposed to cleanly umount before reboot. But it is always possible that power fails or machine hangs. I am really tired of waiting the thing to install and collecting traces of important data all over my harddisks and CD-ROMs (Don't tell me to backup. The point of this post is filesystem corruption, not data loss.) I am now typing this on Windows

Have anyone had similar experience? What can I do if the computer hangs or someone know nothing about computer unplug the power cable?

kaz2100 12-09-2006 09:15 AM

Hi

I am not sure if my experience is helpful.

I had similar situation when I had hardware failure. Disk drive was lousy. Chenged to new drive problem went away.

When case 2 or 3 happens, check syslog and dmesg.

Happy penguins!

yuri_d 12-09-2006 11:19 AM

I think ext3 is extremely tolerable.
My box hung many times because of my own stupidity and could only be recycled by power button on many occasions and I switched off UPS by mistake so power "failed" many times and never the filesystem was damaged...

I had a running domino server, samba, apache and other disk intensive programs.

But because I am not very experienced with Linux it is only IMHO.
Your problem could have to do with your hardwre setup. If it is the same machine.

pigsa 12-09-2006 12:16 PM

I thought about hardware problem. But Case 2 happens in a VM. It seems unlikely to be hardware related.

Cases 1, 3, 4 happen on the same machine. 3 and 4 on the same day...

bigrigdriver 12-09-2006 12:46 PM

I live in a rural area where power interruptions are frequent (weather related). I use ext3, and I have never run e2fsck. On re-boot after power is restored, the ext3 journal is restored automatically.

Given the problems you describe, it's time to consider kernel-related problems, as in 'configuration'.

In /etc/sysconfig/kernel, there is this stanza:
Quote:

# This variable contains the list of modules to be added to the initial
# ramdisk by calling the script "mk_initrd"
# (like drivers for scsi-controllers, for lvm or reiserfs)
#
INITRD_MODULES="amd74xx sata_nv sata_sil jbd ext3"
Check your file to see if INITRD_MODULES includes ext3. If it is there, then should check the kernel config file in /usr/src/linux to see what is/is not compiled relative filesystem journaling.

J.W. 12-09-2006 03:20 PM

The first question for the OP that I'd have is: What filesystem are you using? I'll assume ext2, and if so, I'd strongly suggest using a journaled filesystem such as ext3 or reiserfs.

Over the past couple of years, California has struggled with providing stable electricity, and unfortunately blackouts occur probably once or twice a year. Fortunately my machines have recovered (so far) without any problems or data loss under reiserfs. As a side note, making backups is always a good idea.

BTW, if you are using ext2 and want to convert it ext3, it's pretty easy to do

davcefai 12-10-2006 02:46 AM

For what my experience is worth, ext3 shrugs aside such trivialities as power failures. On boot Debian just restores the filesystems and you'll miss this if you blink.

When I used ext2 I did have occasional glitches after power failures but, to be honest, nothing as bad as the OP describes.

pigsa 12-10-2006 06:41 AM

How stupid I didn't mentioned ext3...

Today I tried again... repeated everything in Case 4.

But e2fsck says filesystem is clean after pressing reset :scratch: ... Using FC6 now :)


All times are GMT -5. The time now is 10:55 AM.