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:
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 /dev/sdb1
Nessun commento:
Posta un commento