Fix for Linux file system error Ddrescue replace DD Recovery software backup Super block

Source: Internet
Author: User
Tags system log

Fix for Linux file system error Ddrescue replace DD Recovery software backup Super block

A recently processed Linux server power outage causes the file system to not read and write, the data is not available
Example, now summarizes the Linux file system error repair method.
EXT3-FS error (device Hda3) in Start_transaction:journal have aborted
If your system abruptly loses power, or if a RAID card is beginning to fail, you might see an
Ominous message like this within your logs:
EXT3-FS error (device Hda3) in Start_transaction:journal have aborted
Basically, the system is telling your that it's detected a filesystem/journal mismatch, and it can ' t
Utilize the journal any longer. When this situation pops up, the filesystem gets mounted read-only
Almost immediately. To fix the situation, you can remount the partition as ext2 (if it isn ' t your active
root partition), or you can commence the repair operations.
If you ' re working with a active root partition, you'll need to boot into some rescue media and
Perform these operations there. If This error occurs with an additional partition besides the root partition,
Simply unmount the broken filesystem and proceed with these operations.
Remove the journal from the filesystem (effectively turning it into ext2):
# Tune2fs-o ^has_journal/dev/hda3
Now, you'll need to fsck it-correct any possible problems (throw-in A-y flag-to-say yes to all
Repairs,-C for a progress bar):

# E2fsck/dev/hda3

Once that's finished, make a new journal which effectively makes the partition an EXT3 filesystem
Again

# tune2fs-j/dev/hda3

You should is able to mount the partition as a ext3 partition at this time:

Mount -T ext3/dev/hda3/mnt/fixed

Be sure to check your DMESG output for any additional errors after you ' re finished!


Data loss caused by a hard drive failure can be disastrous, but if it does, you need to recover the data to the maximum extent possible.

This describes the salvage method of the data when the disk is inaccessible due to a serious problem (but the BIOS can still recognize it), and discusses the EXT2&EXT3 format partition of the disk short-read error.

The first convention: the characters that need to be entered manually are given in boldface, and the remainder is the terminal output.
If you use the ext2 or ext3 file system, you may receive a warning message similar to the following, which comes from the E2fsck utility:

e2fsck/dev/ in short read


If you see this message, the first thought might be that the main super block of the disk is corrupted. While creating the file system, MKE2FS has automatically created a backup of the disk's Super block.

You can tell the E2FSCK program to check the file system using an alternate super block .

An alternate super block is typically created in blocks 8193, 16384, or 32768, depending on the size of the disk (which can be viewed using mkfs.ext3-n/dev/hda1). If it is a large hard disk, use:

32768 /dev/hda1


If the problem is a super block, the backup Super block is enabled and the disk is back to normal after the program returns. If you are prompted with the following issue:

inch  Short  while   for/DEV/HDA1


Note that the problem is not in the Super block, from the log file system log. You can safely delete the logs for the Ext3 file system at this time:

Tune2fs-f-O ^has_journal/dev/hda1


This removes the log on the/dev/hda1 file system, where you can retry mounting the partition, and, if necessary, rebuild the log system (using Tune2fs-j/dev/xxx).
If TUNE2FS prompts for the following error:

inch  Short  while Reading Journal Inode


The inode that points to the log is broken, which means that the log cannot be purged. You can then try the Debugfs command, which is the debugger for the Ext2&3 file system.

You can also use e2fsck again, plus the-c parameter to check the file system for bad blocks. At this point, because the file system on the problem disk cannot be inspected or repaired, it is time to take out the killer.
Cloning a damaged disk using ddrescue
If the disk is blocking the read because of a bad block, you can use an original disk copy utility to create a copy of the disk.

The Unix/linux system comes with a simple utility DD, which copies one file/partition/disk to another (used in the first topic).

Prerequisites, you must add a new hard disk with a capacity that is not less than the problem disk in the system.
When the new hard disk is ready, enter the following command:

DD if=/dev/hda of=/dev/hdb conv=noerror,sync


The above command copies the bad disk (/DEV/HDA) to the new disk (/DEV/HDB), ignores errors encountered while reading (NOERROR), and fills out the output (sync) with an appropriate number of empty values when encountering inaccessible blocks.
But DD has several drawbacks: first, the speed is too slow, then the progress information is not displayed until it is silent before completion;


Do not retry failed reads, which reduces the amount of data that can be recovered from the bad disk. So here we introduce another software--ddrescue,

can be obtained from http://www.gnu.org/software/ddrescue/ddrescue.html
The latest version (Fedora8 users can install directly with yum install dd_rescue).

http://mirrors.ustc.edu.cn/gnu/ddrescue/

Currently ddrescue the latest version is 1.7, direct download link: http://ftp.gnu.org/gnu/ddrescue/ddrescue-1.7.tar.bz2
After compiling, installing, you can use the following command to accomplish the same task:

Ddrescue--max-retries=-1 /dev/hda/dev/hdb


Where the Max-retries=-1 parameter indicates that no matter how many errors are encountered, do not stop. When the program reads the data from HDA and writes it to the HDB, the data is constantly updated to make it easy to see how things work.
After ddrescue ends the disk copy, run e2fsck on the new hard disk to eliminate the bad blocks of the original
System error. Because there are sure to be a lot of errors, you can run e2fsck with the-y parameter to instruct E2fsck to answer yes for each question:

E2fsck-y/dev/hdb


At this point, you can mount the file system using the Mount command to see the data recovery. Remember to check the Lost+found folder in the root directory of the drive

Fsck put files and directories that are not properly linked in this folder

Fix for Linux file system error Ddrescue replace DD Recovery software backup Super block

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.