LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Is there any backup journals like there is backup superblocks ? (https://www.linuxquestions.org/questions/linux-general-1/is-there-any-backup-journals-like-there-is-backup-superblocks-692569/)

exceed1 12-23-2008 03:39 PM

Is there any backup journals like there is backup superblocks ?
 
Hi all

I was wondering, when you get an invalid or bad superblock you can replace it with a backup superblock. But, what happens when you have an invalid ext3 journal, does ext3 have backup journals as well so you can replace the bad journal with a backup journal, if so then how do you find out where the backup journals are ?

I have been googling for this but couldnt find anything like "backup ext3 journals".. so if there isnt anything like that, what do you do if you get an invalid ext3 journal on your filesystem ?

trickykid 12-23-2008 04:24 PM

You really need to understand how ext3 which is a journaled ext2 filesystem works. The most common way to recover from a bad journal or corrupt journal is using the commands e2fsck, debugfs and tune2fs.

In some cases, simply removing the journal can fix the issue. You would run something like this:

tune2fs -f -O ^has_journal /dev/hda1

If that usually results in error, you could try using the debugfs command. If that fails, it might result in cloning the drive and maybe using something like ddrescue

Always try to repair a filesystem first with e2fsck. I've been using ext3 since it's basically been introduced as the default in Linux and have never had any problems. I had to run fsck's way more often on just ext2 filesystems without the journal. I don't miss those days.. ;)

exceed1 12-23-2008 07:01 PM

Thanks for an interesting answer trickykid.

I have read about the ext filesystem family and a little about how they are different. If you remove the journal you would still have a fully functional filesystem, the journal in ext3 would then be there just to pretty much have a lot more reliability. So, in theory (and practice), you could remove the invalid journal and just create a new journal with the tune2fs command' -j option ? That would make it an ext3 filesystem again given that it also has the other features of the ext3 filesystem... but what about the information that was written to the previous journal about data written to the disk, what if the filesystem gets corrupt and then tries to recover using its journal which now only contains a limited log of the data written to the disk.. isnt that going to fail ?

trickykid 12-24-2008 08:57 AM

Quote:

Originally Posted by exceed1 (Post 3385578)
So, in theory (and practice), you could remove the invalid journal and just create a new journal with the tune2fs command' -j option ?

Correct to my knowledge.

Quote:

Originally Posted by exceed1 (Post 3385578)
what if the filesystem gets corrupt and then tries to recover using its journal which now only contains a limited log of the data written to the disk.. isnt that going to fail ?

Well if the journal is corrupt or missing data and the filesystem is also corrupt, this I think is where you should rely on backups hopefully. Unless you catch it in time to turn off the journal or wipe it, then repair the ext2 filesystem in hopes it can correct the issue, if not, you really couldn't rely on either and would need to pull from backups. I've never encountered where both are corrupt at any given time on the same file or block. I guess it's like a RAID 1 setup, what's the chances of both drives failing at exactly the same time? Probably not likely. There's a good chance that if the file itself is corrupt, the journal will recover it. If the journal is corrupt, it won't overwrite the good file. That's at least to my understanding.


All times are GMT -5. The time now is 04:14 PM.