Linux System Management and Maintenance - fsck Command

  

Function Description: Check the file system and try to fix the error. Use format: fsck [options] [-t <file system type>] [device name] Option Description: See the table below for details

Option Meaning -a Automatically repair the file system without any prompts. -r Takes an interactive repair mode and asks when performing a repair, allowing the user to confirm and decide how to proceed. -A Check all file systems listed in the file according to the contents of the /etc/fstab configuration file. -T The header information is not displayed when the fsck command is executed. -V Displays the execution of the fsck instruction. -N Does not execute an instruction, only lists the actions that will be performed during actual execution.

-t <File System Type>: Specifies the type of file system to check. Note: When the fsck command is executed to repair a file system, the disk partition corresponding to the file system must be in the uninstall state. It is extremely insecure to repair the disk partition in the mounted state. The data may be damaged or damaged. Disk. For example: check and try to repair the problem disk partition /dev/sda10, ask when performing the repair, let the user confirm and decide the processing method, display the detailed repair process, use the following command: [root@localhost /]# fsck - rV -t ext3 /dev/sda10 fsck 1.39 (29-May-2006)[/sbin/fsck.ext3 (1) -- /dev/sda10] fsck.ext3 -r /dev/sda10 e2fsck 1.39 (29-May- 2006) /opt contains a file system with errors, check forced.Pass 1: Checking inodes, blocks, and sizesPass 2: Checking directory structurePass 3: Checking directory connectivityPass 4: Checking reference countsInode 6121 ref count is 2, should be 1. Fix< ;y>? yesUnattached inode 6122Connect to /lost+found<y>? yesInode 6122 ref count is 2, should be 1. Fix<y>? yesPass 5: Checking group summary informationBlock bitmap differences: -(519--529) - 9273Fix<y>? yes…… ……/opt: ***** FILE SYSTEM WAS MODIFIED *****/opt: 19/128520 files (15.8% non-contiguous), 46034/514048 blocks# As can be seen from the above, fsck is When copying the file system, the /sbin/fsck.ext3 command is actually called. The fsck repair has undergone a five-step check. If it is found that it needs to be repaired, it will prompt the user whether to repair it. Press the “y“ key to repair it. Any other key skips the fix. When the fsck command is executed, if fsck finds that there are files or directories that are not dependent on the file system, the user will be prompted to retrieve them, because these files or directories that are not dependent on the file system are invisible to the user. It can't be used, it is usually caused by the internal structure of the file system. If the user agrees to retrieve it, even if the above input is "yes" key, the fsck command will put these isolated files or directories into the lost+found directory. Next, and use the corresponding i-node number of these files to name, so that users can find their own lost files, lost+found literal meaning is lost meaning. Therefore, when the user uses the fsck command to repair the disk partition, if there is a file missing in the partition, you can go to the corresponding lost+found directory to find it. Since the file name cannot be distinguished by the file name at this time, we can use the file command to view it. The file system type, which in turn determines which file we need.

Copyright © Windows knowledge All Rights Reserved