What is FSCK and how to FSCK a Linux File System

What is FSCK and how to FSCK a Linux File System

FSCK:

FSCK is refers to a File System Consistency Check that is used to check consistency of a file system in operating system like Linux or Unix. The fsck provides utility to work on data structure directly that is stored in disk. This data structure is virtually available for implementation of file system. With the use of fsck command you can easily repaired damage file system interactively. Either a fsck command is run on booting time or by the administrator manually.

For run fsck command manually follow the following steps:

· Boot your system in single user mode.

· Write the command on command prompt is “fsck -fy”.

· When you run the above mentioned command than you will see a massage on command prompt as “your file has been modified”.

· Again run the command on command prompt is “fsck -y” and do same until you can’t see this massage “your file has been modified” longer.

· After that run the reboot command on command prompt.

Fsck repaired your damage file system and fix the error after repairing the file system. fsck can’t solved the whole problem of file system but it is easy solution to fix the problems.

How to FSCK a Linux FileSystem:

In many situations you have to face the problem occurring error in file system on Linux and other operating system. We have a solution to fix that error via fsck. First find the disk name that has error. Apply the “df” command to see the information about disk.

Filesystem Size Used Avail Use% Mounted on.

/dev/sda3 2.7T 2.6T 106G 97% /

/usr/tmpDSK 4.0G 1.7G 2.2G 44% /tmp

See the filesystem column, for solve this problem; unmount the file system using “umount” command and after that fsck command.

umount /home

Fsck –yC /dev/sda3

You can use other option with fsck but –yC is the best for to fix this error. Y is used to give information about error to fsck and c tells about the progress. Unmount the file system cannot be work properly when a file being used. So check for either a file is used or not applies the following command.

lsof –p |grep/var/

after that you see the whether a file system is used or not than you may apply umount command for unmount the file system properly.

if you have an issue in filesystem on primary partition in your system than you need to boot system in a rescue image. For boot in rescue image use the Netinstall image and boot to the CentOS installation screen and write the following

linux rescue nomount

Then skip the networking and run the shell. After that run the fsck command.

Note that the device name may be incremented in centOS so, the rescue image is considered first and then /dev/sda3/ , /dev/sdb3, /dev/sdc3 and so on. After run the fsck command and reboot the system and confirm that filesystem is cleaned or not by simply applying following.

Dumpe2fs –h/dev/sda3

If the filesystem is cleaned see a massage “clean” if you doesn’t see than your filesystem has major problem.
Author
Jaishree
First release
Last update
Rating
0.00 star(s) 0 ratings
Top