Linux disk and File System Management (2) _ File system detection

Source: Internet
Author: User

File System Detection:


File system Detection Tool fsck is required because the hardware or software may also cause the computer to crash or suddenly shut down due to a power supply, which results in a file system error.


fsck Command

Check and repair a Linux filesystem
Detecting and repairing Linux file systems

Grammar:

fsck [-LRSAVRTMNP] [-C [FD]] [-t fstype] [filesystem ...] [--] [Fs-specific-options]

Fsck.type command:

View the file systems supported by fsck

[Email protected] test]# fsck[tab][tab]fsck fsck.btrfs fsck.cramfs fsck.ext2 fsck.ext3 FSCK.EXT4 Fsck.minix FSC K.xfs

Parameters:

-T: Specifies the file system for the detected partition

-A: Auto fix errors, do not always press Y to confirm

-R: report test data such as status, time consuming

-F: Force detection

-A: Scan the device one time according to/etc/fstab

-R: When detected, you can skip the mounted root directory, as detected by the-a scan list

Example:

[[Email protected] 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[[email protected] test]#  #强制检测, add the-f parameter to display the detection process [[email protected] 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

Attention:

1 when performing fsck, the detected partition needs to be in the unloaded state

2 typically does not use fsck for detection and may result in data loss

e2fsck : Inspection Repair tool (check a Linux ext2/ext3/ext4 file system) dedicated to the EXT series filesystem

Parameters:

-P: Automatically fix file system errors

-N: Do not modify the file system

-C: Detect bad blocks and add bad block list

-A: equivalent to-P

-F: Force detection

-Y: Auto Answer Yes

Example

#强制检测 [[email protected] test]# e2fsck-f/dev/sdb5e2fsck 1.42.9 (28-dec-2013) Pass 1:checking inodes, blocks, and Sizespas S 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# auto Fix error [[email protected] test]# e2fsck-p/dev/sdb5/dev/sdb5:clean, 11/32768 files, 6353/131072 blocks


When E2fsck detects mounted partitions: read-only Test

[Email protected] 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



If there is any mistake, please correct me!

Thank you!


Linux disk and File System Management (2) _ File system detection

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.