Monday, May 11, 2009

Manage Ubuntu - fsck

fsck stands for “file system check” or “file system consistency check.” This command will check and interactively repair inconsistent file systems. Under normal circumstances, the file system will be consistent, and the fsck command will only report on the number of files, used blocks, and free blocks in the file system. If the file system is inconsistent, then the fsck command will display information about the inconsistencies that it found, and it will ask you if you want to repair them. By default, the Ubuntu operating system will run fsck every 30 reboots on its own; however, if you would like to run this command manually, you have that option as well. The easiest way to run fsck manually is to open the Terminal and type

sudo fsck

When you’re running a command from the terminal, most commands have options or flags that can be attached to the command to set parameters for the command. In the crontab file we edited earlier in this chapter, the line read

00 00 * * * /usr/bin/apt-get update && /usr/bin/apt-get upgrade -y

Here, the –y is an example of an option. It tells the upgrade command to answer any questions with a yes. fsck has many different options that can be placed after the command. Some of these are

–N Don’t execute any changes to the file system if errors are found, only show what should be done to fix it.

–V Give back verbose output. Verbose output is very detailed and can take much longer to run this command.

–a Automatically repair the file system without asking questions.

–r Interactively repair the file system being checked.

The following command would run fsck and repair any corruptions it may find. Keep in mind that all options for commands are case sensitive. –N is not the same as –n.

sudo fsck -a

If fsck is giving you trouble when you run the command manually, you can force it to run by typing

sudo touch /forcefsck

Source of Information : McGraw Hill Ubuntu The Complete Reference

No comments: