Using fsck to fix file system errors

Source: Internet
Author: User

1 , problem description

Server Maint_samba

Because the server Maint_samba (Debian operating system) does not shut down properly,/DEV/SDB1 file system errors occur during the restart process and need to be manually scanned and repaired using FSCK. The following conditions occur:

......

Checking file Systems ... fsck 1.41.3 (12-oct-2008)

/DEV/SDB1 contains a file system with errors check forced

/DEV/SDB1: |========== Percentage%

......

/dev/sdb1:unexpected inconsistency; RUN fsck manually (i.e., without-a or-p options)

Fsck died with exit STATUS4

......

/VAR/LOG/FSCK/FSCK---fsck error log storage location

......

Warning

......

Press ENTER for maintenance

(or type control-d to continue):---ctrl+d continue to start the server.

2 , Manual fsck Fix

2.1 fsck Introduction

Fsck can not only scan the file system, but also fix some problems with the file system. It is important to note that fsck scans the file system when it must be in single-user mode, repair mode, or after umount the device.

Warning: If you scan a running system, it will cause system file corruption.

The file system Scan Tool has Fsck,fsck.ext2,fsck.jfs,fsck.msdos,fsck.vfat,fsck.ext3,fsck.reiserfs (REISERFSCK). which fsck default support file system ext2 , if you want to support ext3 file system Scan, should be added-j parameters. It is best to invoke different scanning tools based on different file systems , such as the Ext3 file system using the Fsck.ext3,ext2 file system fsck.etx2.

/DEV/SDB1 is a ext3 file system that only introduces FSCK.EXT3

Fsck.ext3

[ syntax]

fsck.ext3[necessary parameters [selection parameters] [device code]

[ function]

FSCK.EXT3 command:

Detection for EXT3 type file systems

[ Execute permissions]

Super User Average user

[ parameter]

Necessary parameters

-A non-interactive mode, automatic repair

-C Check if there is a damaged chunk.

-c< anti-narrator > Fsck.ext3 command will take all the execution of the process, are referred to the reverse narrative, easy to monitor the program

-d verbose display of command execution procedures

-F Force Check

-F before checking the file system, clean up the data in the Save Device block area first

-l< corrupt block files > Add tags to damaged chunks listed in the file

-l< corrupt block file > Clear all Damage flag, re-mark

-N non-interactive mode, set the file system to be checked read-only

-p< number > Set how much inode size the FSCK.EXT2 command can handle

-R Interactive Mode

-R Ignore Directory

-S sequential check

The-s effect is similar to specifying the "-S" parameter

-T displays timing information for the FSCK.EXT2 command.

-V displays detailed processing procedures

-Y Close Interactive mode

Select parameters

-b< partition first magnetic region address > Start address of the first magnetic region of the specified partition/super Block

-b< Chunk Size > Set the size of each chunk of the partition

-I sets the number of chunks to check for the file system whose Inode buffer

-V Display version information

[ Reference Example]

Example 1: Detecting a disk

[Email protected] test]# fsck.ext3/dev/fd0

Example 2: Detecting a disk and displaying timing information

[Email protected] test]# fsck.ext3-ft/dev/fd0

2.2 Server Maint_samba using FSCK.EXT3 Repair process for file system

2.2.1 View Fsck Log of error

fileserver:~# ls-l/var/log/fsck/

Total 8

-rw-r-----1 root adm 2011-06-09 10:03 Checkfs

-rw-r-----1 Root adm 192 2011-06-09 10:03 Checkroot

There will be an error message for fsck in these two files.

fileserver:~# MORE/VAR/LOG/FSCK/CHECKFS

fileserver:~# More/var/log/fsck/checkroot

2.2.2 to view the current RunLevel:

FSCK.EXT3 scanning the file system must be done in single-user mode, repair mode, or after the device is Umount . If you scan a running system, it can cause system file corruption.

Choose to run in single-user mode

# runlevel---View run level

fileserver:~# RunLevel

N 2

#init 1-Single user mode (1 S), you may need to enter the root password when converting to single user mode.

fileserver:~# Init 1

2.2.3 using FSCK.EXT3 scanning and repairing the file system

fileserver:~# fsck.ext3-y/DEV/SDB1---Start scanning, correcting file systems

Note the red box, where you need to enter Yes

FSCK.EXT3 began to enter the scanning, correction file system, the process time is longer, the middle of a number of pauses in the process, just wait, do not think that the crash and restart the server.

After the FSCK.EXT3 scans and corrects the file system, you may need to restart the system as prompted. If you are not prompted to restart the system, you will need to reboot to restart the system.

fileserver:~# Reboot---Restart system

In the process of rebooting the system, FSCK scans the file system as follows:

After the FSCK scan is completed, the login interface of the system is launched and no interference is required.

Restart the system again and the system will start normally.

This server Maint_samba using FSCK to repair the file system.

Using fsck to fix file system errors

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.