How to repair filesystem after crash

fsck command:
fsck is a command used to check filesystem for consistency errors and repair them on Linux filesystems.

[root@server ~]# umount /home
or,
[root@server ~]# umount  /dev/sda2

Now run fsck on the partition: 
[root@server ~]# fsck /dev/sda2

Specify the file system type using -t option:  

[root@server ~]# fsck -t ext4 /dev/sda2

fsck will check the file system and ask which problems should be fixed or corrected. If you don't wanna type y every time then you can use pass -y option to fsck: 

[root@server ~]# fsck -y /dev/sda2

Please note if any files are recovered then they are placed in /home/lost+found directory by fsck command.

Once fsck finished, remount the file system:

[root@server ~]# # mount /home

That’s it ……..:)


###########Thanks for visiting#####################

Share on Google Plus

About Penguin Technology

I am a passionate cloud and DevOps professional specializing in Linux and open-source solutions. Through this blog, I share my knowledge and experience with the community, offering tips and insights on cloud technologies and DevOps practices.
    Blogger Comment

0 comments:

Post a Comment