[Linux-basic] is your file system normal?

Source: Internet
Author: User
[Linux-basic] is your file system normal? -- Linux general technology-Linux programming and kernel information. The following is a detailed description. In a project, the data in the cabinet cannot be accessed, but the system cannot be accessed. Stop checking the partition in fsck. The error message is as follows:

Your systems appears to have shut down unclearly, ''' checking root filesystems '''''
Unexpected inconsistency; RUN fsdk MANUALLY (I. e., without-a or-p option) [FAILED]
* ** An error ocurred during the file system check Dropping you to a shell; the system will reboot
*** When you leave the shell Give root password for maintence
(Or type Control-D to continue ):

Two problems arise:

1. Since I stay at The fsck, I only want to enter the system. Is there any way to shield the check from directly accessing the system?

2. data cannot be accessed. Is there a bad track or a physical bad track? Logical bad track?

Solution:

1. for blocking check, you only need to modify the cabinet check option in/etc/fstab, that is, it can be changed from non-1 to 0.

/Dev/sdc1/opt ext3 defaults 1 1 #1 --> 0

This operation can go to the system, but it is not the right way. In this case, you must check the system. In this case, you can enter the system in linux single or linux rescue mode and partition the problematic umount, then execute badblock to check the file block. This operation can only be performed logically. As for physical use, if the hardware vendor is required to perform this operation, some may say that e2fsck-c can also be checked. Please refer to man e2fsck for details. The command that e2fsck finally calls is also badblock. Currently, only badblock is checked for file blocks. As far as I know, please let me know if you have other recommendations. Thank you very much.

Now let's check the health of the Cabinet partition. First, let's take a look at the available badblock options.

Badblocks-query Bad blocks of devices

SYNPSIS)

Badblocks [-svwnf] [-B block-size] [-c blocks_at_once] [-I input_file] [-o output_file] [-p num_passes] device [blocks-count] [start -block]

(DESCRIPTION) DESCRIPTION

Badblocks is used to detect Bad blocks on devices (usually Disk Partitions.

The device parameter is the device name (for example,/dev/hdc1 ).

The blocks-count parameter indicates the total number of blocks on the device. If this parameter is not specified, the default value is the capacity of the device.

The start-block parameter is an optional parameter that specifies the number of block numbers to start detection. Therefore, detection can start from the middle of the disk.

OPTIONS)

-B block-size indicates the block size in bytes.

-C number of blocks the number of blocks detected each time. The default value is 16. Increasing the number can increase the efficiency of detecting Bad blocks and increase the memory consumption.

In read-only mode, the Badblocks command consumes the same amount of memory as each detected block. In read/write mode, this ratio is twice, and in non-destructive read/write mode, this ratio is three times. If you set the parameter "num-of-blocks" to too large, badblocks will immediately exit when the cache is allocated due to a memory overflow error. Of course, if you set this value too low in non-destructive read/write mode, therefore, blocks with problems on an unstable disk may not be detected due to disk track buffering.

-F normally, the badblocks command does not detect the read/write mode on an activated device or non-destructive read/write mode, because it may cause the system to crash. The-f flag can be used to force execution in this case, but it is best not to use it normally. This parameter is safe only when an error occurs in the/etc/mtab file and the device is not actually activated.

-I input_file: reads a list of known bad blocks. The Badblocks command skips block checks that are known to be bad blocks. If the input_file parameter is "-", the list is read from the standard input. Blocks listed in this list will also be ignored when a new bad track record file or bad track record is output.

-O output_file: writes the bad block list to the specified file. Without this option, the badblocks command will output this list in the standard output. The format is compatible with the requirements of the-l option of e2fsck (8) or mke2fs (8.

-P num_passes: scan the disk repeatedly until the disk is scanned again. The default value is 0. It indicates that the badblocks command will end after a scan is successfully executed.

-N uses a non-destructive read/write mode. The default value is a non-destructive test in read-only mode. This option cannot be used with the-w option because it is mutually exclusive.

-S outputs the number of the block being detected to indicate the detection process.

-V hybrid mode detection.

-W: Use the write mode for testing. By using this option, badblocks writes some specific characters (0xaa, 0x55, 0xff, 0x00) to each block, reads and compares the content, determine whether it is a bad block. This option cannot be used with the-n option because they are mutually exclusive. Do not use the-w option on a device that already contains a file system. This option will delete the original data! If you want to perform read/write mode detection on a device with a file system, use the-n option. Although it is slow, it can protect your data from harm.

When badblocks is used for scanning, the system prompts the existence of bad blocks and the bad block is located at the end of the disk, that is, the following information.

[Root @ zxj ~] # Badblocks-s-v-o/tmp/sdc1.log/dev/sdc1
Checking blocks 0 to 1102398278
Checking for bad blocks (read-only test): done
Pass completed, 2 bad blocks found.
Then I checked/tmp/sdc1.log, which is shown as follows:
1102398276
1102398277

After a bad track occurs, you can use fsck-t ext3-l/tmp/sdc1.log/dev/sdc1 to drop the bad block screen so that the OS does not use it, the badblock error was not prompted during The fsck check.

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.