Linux Check Disk Corruption command-must be

Source: Internet
Author: User

Cause: Some time ago, a friend interview, there is a face question asked is how to detect when the disk damage. Beware of the heart is a fierce click stops, as if they do not know yes, OK. So it took some time to tidy up a bit.


1, Badblocks

Function Description: Check the damaged block in the disk device.

Syntax: badblocks [-svw][-b][-o] [disk device] [number of disk blocks] [start chunk]


Note: When executing the instruction, you must specify the disk device to be inspected and the number of disk blocks for this device.


Parameters


-b Specifies the chunk size of the disk in bytes.


-O Writes the result of the check to the specified output file.


-S shows progress while checking.


-V displays detailed information when executed.


-W performs a write test when checking.


[Disk device] Specifies the disk device to check.


[Number of disk blocks] Specifies the total number of blocks for the disk appliance.


[Start Block] Specifies the block from which to start the check.



2.

Dd


Function Description: Read, convert and output data.


Syntax: DD [bs=][cbs=][conv=][count=][ibs=][if=][obs=][of=][seek=][skip=][--help][--version]


Note: DD can read data from a standard input or file, convert data in a specified format, and then output to a file, device, or standard output.


Parameters


Bs= sets the IBS (input) and OBS (output) to the specified number of bytes.


cbs= conversion, only the specified number of bytes is converted at a time.


conv= Specifies how the file is converted.


Count= reads only the specified number of chunks.


ibs= the number of bytes per read.


if= read from file.


obs= the number of bytes per output.


of= output to a file.


Seek= the specified number of chunks is skipped at the beginning of the output.


skip= skips the specified number of chunks when it starts reading.


--help Help.


--version Displays version information.


3.

E2FSCK (ext2 file system check)


Function Description: Check the correctness of the ext2 file system.


Syntax: e2fsck [-accdffnprsstvvy][-b][-b][-l][-l] [device name]


Supplementary note: The return value of e2fsck after execution and the meaning of the representative are as follows.


0 no errors occurred.


1 File system error has occurred and has been fixed.


2 File system error has occurred and has been fixed.


4 File system error, but no fix.


8 error occurred while working.


16 The syntax used has an error.


128 An error occurred in the shared function library.


Parameters


-A automatically repairs the file system without asking the user for comments.


-b specifies superblock without using the preset superblock.


-b Specifies the size of the chunk, in bytes.


-C Execute the badblocks together to indicate the damaged block.


-c The information of the inspection process is fully recorded in file descriptor, so that the entire inspection process can be fully monitored.


-D Displays the troubleshooting information.


-F force checks for correctness even if the file system has no signs of error.


-F clears the buffer of the device before executing.


-L adds the block specified in the file to the list of damaged chunks.


-L Clears the list of corrupted chunks before adding the chunks specified in the file to the list of damaged chunks. As a result, chunks that damage the block list are the same as the chunks specified in the file.


-N Opens the file system in read-only mode and executes it in a non-interactive manner, all of the problem dialogs are set to answer "no".


-P automatically repairs the file system without asking the user for comments.


-r This parameter exists only for compatibility and has no practical effect.


-S If the file system has an inappropriate byte order, the byte order is swapped, otherwise no action is made.


-S swaps byte order regardless of the byte order of the file system.


-T displays time information.


-V displays detailed information when executed.


-V Displays version information.


-Y takes a non-interactive approach and all the questions are set to answer "yes".

4.

Ext2ed (ext2 file System Editor)


Function Description: Ext2 file system editing program.


Syntax: ext2ed


Additional note: Ext2ed can directly handle data on the hard drive partition, which is only available on Red Hat Linux.


Parameters


General Instructions


setdevice[Device Name] Specifies the device to be processed.


Disablewrite sets the ext2ed to read-only status.


Enablewrite sets the ext2ed to read-write status.


help[instruction] Displays help for individual instructions.


Next moves to the next unit, depending on the mode in which it is currently located.


Prev Move to the previous unit, the units will vary depending on the mode in which they are currently located.


PgUp move to the next page.


PgDn move to the previous page.


Set modifies the current data, the parameters will vary depending on the current mode.


WriteData the data in the partition is not actually modified until this command is executed.


Ext2 Enter 3 modes of instruction


Super enters main superblock, which is Superblock mode.


Group enters the specified group, which is the group mode.


In Inode mode, the CD enters the specified directory or file, which is the inode mode.


Superblock mode


Gocopy into the specified superblock backup.


Setactivecopy copies the currently located superblock to main superblock.


Group mode


Blockbitmap shows the current block map of Groupo.


The inode enters the current group's first inode.


INODEBITMAP Displays the current Inode binary code for group.


Inode mode


Dir enters directory mode.


File into the document mode.


5.

Fdisk


Feature Description: Disk partition.


Syntax: fdisk [-B][-uv][Peripheral Device code] or fdisk [-l][-b][-uv][Peripheral Device code ...] or Fdisk [-s]


Add: fdisk is a disk partition program, it uses the traditional question-and-answer interface, rather than DOS Fdisk-like Cfdisk interactive interface, it is inconvenient to use, but the function is not compromised.


Parameters


-b Specifies the size of each partition.


-l lists the partition table status for the specified peripheral device.


-s outputs the specified partition size to the standard output, in chunks.


-U is paired with the "-L" parameter list, which replaces the number of cylinders with the number of partitions to represent the starting address of each partition.


-V Displays version information.

6.

FSCK.EXT2 (File system Check-second filesystem)


Feature Description: Check the file system and try to fix the error.


Syntax: fsck.ext2 [-acdffnprsstvvy][-b][-b][-c][-i][-l/l][-p] [peripheral Device code]


Additional Note: When an error occurs with the Ext2 file system, the FSCK.EXT2 instruction can be used to try to fix it.


Parameters


-A automatically repairs the file system without asking any questions.


-b Specifies the starting address of the first magnetic region of the partition, which is super Block.


-B Sets the size of each chunk of the partition.


-C checks the specified file system for the presence of a damaged chunk.


-c Specifies the counter-narrator, the fsck.ext2 instruction will be all the execution of the process, all to the reverse narrative, easy to debug or monitor the implementation of the situation.


-D Displays the instruction execution process in detail to facilitate troubleshooting or analyzing the execution of the program.


-F forces a full check of the file system, even though the file system does not have a problem with a slight check.


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


-I sets the number of chunks of the file system whose inode buffer to check.


-L treats the blocks listed in the file as corrupted chunks and marks them out to prevent the application from using the block.


-L This parameter has the same effect as specifying the "-L" parameter, but before referencing the damaged block file for the damaged block, it is clear that the original is marked as a damaged chunk, that is, all reset, rather than just adding new damaged block markers.


-N Sets the file system to be checked to read-only, closes the interactive mode, and rejects all questions asked.


-P This parameter has the same effect as specifying the "-a" parameter.


-P Sets the number of inode sizes that the fsck.ext2 instruction can handle.


-r This parameter ignores non-processing and is only responsible for resolving compatibility issues.


-S swaps the contents of each pair of bytes when checking the file system.


-S The effect of this parameter is similar to specifying the "-S" parameter, but the contents of each pair of bytes are exchanged regardless of whether the file system is already a standard bit order.


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


-V shows the instruction execution process in detail.


-V Displays version information.


-Y Closes the interactive mode and agrees to all questions asked.

7.

Fsck (file system check)


Feature Description: Check the file system and try to fix the error.


Syntax: fsck [-AANPRRSTV][-T] [File system ...]


Additional note: When the file system error four modernizations, the fsck command can be used to try to repair.


Parameters


-A automatically repairs the file system without asking any questions.


-A according to the contents of the/etc/fstab configuration file, check all the file systems listed in the file.


-N does not execute instructions, only the actions performed by the actual execution are listed.


-p when used with the "-A" parameter, all file systems are checked at the same time.


-R uses interactive mode to ask questions when performing a fix, allowing the user to confirm and decide how to handle it.


-R when used with the "-A" parameter, the file system that is skipped/directory is not checked.


-S executes the check job sequentially instead of concurrently.


-t specifies the type of file system to check.


-T displays header information when the fsck instruction is executed.


-V Displays the instruction execution process.

8.

Cfdisk


Feature Description: Disk partition.


Syntax: Cfdisk [-avz][-c-h-S][-p] [peripheral Device code]


Added: Cfdisk is a disk partitioning program, it is very similar to Dos Fdisk, with an interactive interface rather than the traditional Fdisk question-and-answer interface, you can easily use the arrow keys to manipulate the partition operation.


Parameters


-A in the program do not use anti-white representative selection, and the arrows.


-C ignores the numeric value of the BIOS and directly specifies the number of cylinders on the disk.


-H ignores the numeric value of the BIOS and directly specifies the number of disk heads.


-P Displays the contents of the partitioned table, the additional parameter "R" displays the details of the entire partition table, the additional parameter "s" displays the relevant information according to the order of the magnetic region, the additional parameter "T" will be the head, magnetic region, cylinder display data.


-S ignores the numeric value of the BIOS and directly specifies the number of magnetic regions of the disk.


-V Displays version information.


-Z does not read the existing partition and is used directly as a new disk with no partitions.



If you find it useful, just praise it.

Linux Check Disk Corruption command-must be

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.