Repair linux File System corruption

Source: Internet
Author: User
Fix and damage the linux File System-Linux Enterprise Application-Linux server application information. For more information, see. Revised by woflman 2007.08.05
This morning, my server failed to start and stopped for inspection.
Mail.wofman.com/var filesystem bad, my mail file is in this directory;
Bad magic number in super_block while trying to open/var
* ** An error occured during the file system check
* ** Dropping you to a shell; the system will reboot
*** When you leave the shell.
Press enter for maintenance
(Or type Control-D to continue ):
Enter admai pass and enter (Repair filesystem )#
Check whether/etc/fstab is correct,
Run fsck-p/var
After the task is completed, the following message is displayed:
/Dev/sda3 contains a file system with errors, check forced.
/Dev/sda3: Inodes that were part of a specified upted orphan linked list found.

/Dev/sda3: unexpected inconsistency; RUN fsck MANUALLY.
(I. e., without-a or-p options)

Run fsck. ext3-p/dev/sda3; failed to fix
Run fsck. ext3-y/dev/sda3; repair OK
; Note that umount should be run to fix other filesystems.
File System-fsck
Command: fsck

Permission: Super User

Usage: fsck -- help
Fsck 1.35 (28-Feb-2004)
Fsck. ext3: invalid option -- h
Usage: fsck. ext3 [-panyrcdfvstDFSV] [-B superblock] [-B blocksize]
[-I inode_buffer_blocks] [-P process_inode_size]
[-L |-L bad_blocks_file] [-C fd] [-j ext-journal]
[-E extended-options] device
Emergency help:
-P Automatic repair (no questions); Automatic repair
-N Make no changes to the filesystem; simulated repair
-Y Assume "yes" to all questions; all questions are answered yes
-C Check for bad blocks and add them to the badblock list
; Check Bad blocks and record the list of bad Blocks
-F Force checking even if filesystem is marked clean
; Forcibly check the file system marked as "clean" v Be verbose; details
-B superblock Use alternative superblock
-B blocksize Force blocksize when looking for superblock
-J external-journal Set location of the external journal
-L bad_blocks_file Add to badblocks list
-L bad_blocks_file Set badblocks list

Reference an example on the Internet:

Problem: When SLES8 mounts the disk array
Server1: // # mount/dev/sde1/foo
Mount: wrong fs type, bad option, bad superblock on/dev/sde1,
Or too mounted file systems

. How can this problem be solved?

Answer:
This error message indicates that the super block of the ext3 File System on the/dev/sde1 device is damaged, and the metadata of the ext3 file system is saved in the super block.

The ext3 file system also has several backup Super blocks. You can try to use the backup super block to load the ext3 file system and repair the ext3 file system.

The backup super block information can be obtained through the following command. This command simulates the action when the ext3 file system is created and prints the position of the backup super block. The default position is 4 K, when using the mount command, you need to provide an offset in the unit of 1 K, which must be multiplied by 4:

Note !!!!! You must use '-n' as the parameter to simulate the creation of the ext3 file system instead of creating the ext3 file system.
# Mkfs. ext3-n/dev/hda7
Mke2fs 1.38 (30-Jun-2005)
Filesystem label =
OS type: Linux
Block size = 4096 (log = 2)
Fragment size = 4096 (log = 2)
2198880 inodes, 4393738 blocks
219686 blocks (5.00%) reserved for the super user
First data block = 0
135 block groups
32768 blocks per group, 32768 fragments per group
16288 inodes per group
Superblock backups stored on blocks:
32768,983 04, 163840,229 376, 294912,819 200, 884736,160 5632, 2654208,
4096000

Run the following command to load the ext3 File System Using the backup super block:

Syntax: mount. ext3-o sb = n
# Mount. ext3-o sb = 131072/dev/hda7/media/hda7

Use the backup super block to restore the ext3 File System Command

Syntax: fsck. ext3-B superblock
# Fsck. ext3-B 32768/dev/hda7
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.