Linux disk and file system management (2) _ file system detection
File system check: The file system check tool fsck (file system check) is required because the hardware or software may crash or suddenly shut down the computer due to power supply) the fsck command check and repair a Linux filesystem checks and fixes the linux File System Syntax: fsck [-lrsAVRTMNP] [-C [fd] [-t fstype] [filesystem...] [--] [fs-specific-options] fsck. type COMMAND: view the file system supported by fsck 12 [root @ localhost test] # fsck [TAB] [TAB] fsck. btrfs fsck. cramfs fsck. ext2 fsck. ext3 fsck. ext4 fsck. minix fsck. xfs parameter:-t: Specify the file system of the partition to be detected-a: automatically fix the error, do not always press y to confirm-r: Report detection data such as the status, time consumed-f: forced detection-A: scan the device once according to/etc/fstab-R: during detection, for example, based on-A scan list detection, you can skip the mounted root directory example:
[Root @ localhost test] # fsck-t ext4/dev/sdb5fsck from util-linux 2.23.2e2fsck 1.42.9 (28-Dec-2013)/dev/sdb5: clean, 11/32768 files, 6353/131072 blocks [root @ localhost test] # force detection, add the-f parameter to display the detection process [root @ localhost test] # fsck-f-r-t ext4/dev/sdb5fsck from util-linux 2.23.2e2fsck 1.42.9 (28-Dec-2013) Pass 1: checking inodes, blocks, and sizesPass 2: Checking directory structurePass 3: Checking directory connectivityPass 4: Checking reference countsPass 5: Checking group summary information/dev/sdb5: 11/32768 files (0.0% non-contiguous), 6353/131072 blocks/dev/sdb5: status 0, rss 1548, real 0.023808, user 0.001684, sys 0.007371
Note: 1. When fsck is executed, the detected partition needs to be detached. 2. fsck is usually not used for detection, which may cause data loss e2fsck: ext file system-specific detection and Repair Tool (check a Linux ext2/ext3/ext4 file system) parameter:-p: Automatic Repair of file system errors-n: do not modify the file system-c: Check Bad blocks, and add the Bad Block List-a: equivalent to-p-f: Forced detection-y: automatically answer the yes example
# Force detection [root @ localhost test] # e2fsck-f/dev/sdb5e2fsck 1.42.9 (28-Dec-2013) Pass 1: Checking inodes, blocks, and sizesPass 2: Checking directory structurePass 3: checking directory connectivityPass 4: Checking reference countsPass 5: Checking group summary information/dev/sdb5: 11/32768 files (0.0% non-contiguous ), 6353/131072 blocks # Automatic repair error [root @ localhost test] # e2fsck-p/dev/sdb5/dev/sdb5: clean, 11/32768 files, 6353/131072 blocks
When e2fsck detects mounted partitions: only read tests are performed.
[root@localhost test]# e2fsck -n /dev/sda3e2fsck 1.42.9 (28-Dec-2013)Warning! /dev/sda3 is mounted.Warning: skipping journal recovery because doing a read-only filesystem check./dev/sda3: clean, 11521/640848 files, 210961/2560000 blocks