How does Linux solve system problems with fsck?

  


Going to work at the company today, there is no problem in starting up in the morning. After going out for a while, after returning to the meal, after pressing any key, the machine does not respond, only see the black background and the white mouse. The indicator light is still on, the only thing that does not have is the pop-up password input dialog box, so I restarted the machine and there was a problem:

************* ***


*** AN error occurred during the file system check

*** Dropping you to a shell; the systm will reboot

*** when you leave the shell

Give root password for maintenance

(or type Control-D to continue):



My system is redhat 5.5. The following hopes are useful to all my colleagues:

After this problem, I looked at it:

Give root password for maintenance

(or type Control-D to continue):

Means let me enter the root password or press CTR+D to restart

So I lost the root password. The following situation occurs:

(Repair Filesystem) 1 #

Because I was not familiar with fsck at first, I lost it directly, followed by a series of inquiries, just yes

(Repair filesystem) 1 # fsck

It may take a while to get in the middle, because the file repair event is a bit long and there is no hint that might bother you, so you should be patient.

. . . . . . .

After the last modification, there will be a message like this:

(Repair filesystem) 2 #

At this point, you can reboot by just rebooting

(Repair filesystem) 2 # reboot

Let's talk about the fsck command!

The fsck command is abbreviated as file system check to check and maintain inconsistent file systems. If the system is powered down or there is a problem with the disk, you can use the fsck command to check the file system.

Linux Tips: Use the Fsck command to repair the damaged partition

Enter the root password and log in: fsck – t ext3 -r /usr/local fix

Several commands for fsck commands: fsck

Permissions: superuser root

How to use: fsck [ ,null,null,3],-sACVRP] [-t fstype] [–] [fsck-options] filesys […]

Description: Check and repair the Linux file system, you can check one or more Linux file systems at the same time

Parameters: filesys :device name (eg./dev/sda1), mount point (eg. /or /usr)

-t : the form of the given file system, if in /etc/fstab The existing definition does not need to add this parameter

-s : Execute the fsck instructions one by one to check

-A : all listed in /etc/fstab Partition check

-C : Show full check progress

-d : Print debu of e2fsck g Result

-p : When there is a -A condition, multiple fsck checks are executed together.

-R : Omitted/not checked when there is a -A condition

-V : Detailed display mode

-a : Automatically repair if there is an error in the check

-r : If the check is wrong, the user will answer whether to fix it

Example: Check if the /dev/hda5 of the msdos file system is normal, and fix it automatically if there is an exception: fsck -t msdos -a /dev/hda5

Note: This directive can be referenced with /etc/fstab Operate to understand.

Copyright © Windows knowledge All Rights Reserved