This page is a default template for documentation on the wiki. To create a new guide on the wiki, read the page WikiGuide.

Please Include

I am listing information that I would like included in this article. Clearly, this article is a work in progress, and maybe I will clean it up a bit. Till then, I'm just listing the links I found.

One question I have, is to how to run fsck on /. This link offers a solution. Also, please include the information in this link which describes how to change the frequency that a fsck is run at startup.

Introduction

This page introduces the fsck utility, used to check and repair file systems.

File systems can become inconsistent. This can be caused by power failure, incomplete shut-down and hardware failure. This causes file system operations to be incomplete.

This is less of a problem with journalized file systems (such as Ext3) which write changes to a log journal before committing to the main file system. In the case of a failure, the journal is re-executed until the system is consistent.

If the system is interrupted and every thirty reboots, fsck is run.

The many faces of fsck

To the new user, there often seems to be a lot of applications with similar names to fsck, such as fsck, fsck.ext2 and e2fsck. This is because different applications have been written for each file system as it has been written. In order to consolidate this into one system, the file system name is appended to fsck to run that utility.

For example: fsck.ext2 runs fsck on an ext2 file system.

How does it know which file systems to check?

The /etc/fstab file is scanned. All non-zero pass numbered partitions are checked starting with one (which is normally the root partition).

Next all mounted file systems are scanned sequentially.

Running

Fsck should always be run in single user mode other wise data can be corrupted.

Fsck runs in two modes: interactive - where each error encountered requires the users input and non-interactive where fsck attempts repair.

The program is run using the command: Help

fsck --help

Interactive:

fsck -F file_system_type partition

Non-interactive:

fsck -F file_system_type -y partition

For example, to check an ntfs partition, /dev/sdb1 non-interactively:

fsck -F ufs -y /dev/sdb1

It is also possible to run via the shutdown command:

shutdown -rF

Check in /var/log/fsck for results if running on a headless system or a VM where the console is not available during boot.

Errors

Still writing, finish tommorrow.

This page is maintained by DougieRichardson.


CategoryAdministration

SystemAdministration/Fsck (last edited 2011-04-07 21:00:01 by k.dejong)