From ArchWiki
Revision as of 19:06, 3 April 2011 by Epsilom (talk | contribs) (add "Change Disk Check Frequency" (please check english grammar))
Jump to: navigation, search

What is Fsck?

Fsck stands for "file system check" and it is used to check and optionally repair one or more Linux file systems. A filesystem can be a device name (e.g. /dev/hdc1, /dev/sdb2), a mountpoint (e.g. /, /usr, /home), or an ext2 label or UUID specifier (e.g. UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd or LABEL=root). Normally, the Fsck program will try to handle filesystems on different physical disk drives in parallel to reduce the total amount of time needed to check all of the filesystems. (Source: man fsck)

The Arch Linux boot process conveniently takes care of the Fsck procedure for you and will periodically check all relevant partitions on your hard drive automatically in a scheduled manner. Hence, there is usually is no need to resort to the command line unless necessary.

Invoking Fsck Manually - The Easy Way

Suppose you opt to run a full Fsck check, manually, on your next system reboot. This can be done very easily with one command in Arch Linux. First, exit your desktop environment or window manager, log into root (#), and type the following command:

# shutdown -Fr now

The command shutdown will bring down the system in a secure manner, -F forces Fsck to be safely invoked on a reboot, -r causes the system to reboot after shutdown, and now shuts down the system immediately.

After entering the above command, press ENTER. The system will reboot immediately. When your Grub menu appears (assuming you are using it), enter Arch Linux like you normally do. During the boot process, you will see that Fsck has been invoked and checks all relevant partitions on your hard drive. This manual procedure is simple, fast, and hassle free.

Other Fsck Tricks

All of these can be found by running

# fsck -h

To automatically repair damaged portions, run:

# fsck -a

WARNING: This will not ask if you want to repair it, as the answer is "Yes" when you run that

To make no changes to the filesystem (opposite of automatic option meaning the answer is "No" when asked about fixing errors), run:

# fsck -n

Change Disk Check Frequency

For default after 30 boot fsck check disk, This is invididual count for partition, for change frequency check do:

# tune2fs -c 20 /dev/sda1

in this example the "20" is a number of boot for the next check, 1 makes it scan at every boot, 0 stops scanning altogether. The "/dev/sda1" is a partition (no disk) to change frequency check.

if you want see the number of frequency check and count boot in one partition:

# dumpe2fs -h /dev/sda1 | grep -i 'mount count'

fstab options

/etc/fstab is a system configuration file and is used to tell the Linux kernel which partitions (file systems) to mount and where on the file system tree.

A typical fatab entry may look like this:

/dev/sda1 / ext4 defaults 0 1
/dev/sda2 /other ext4 defaults 0 2
/dev/sda3 /win ntfs defaults 0 0

The 6th column (in bold) is a fsck options.

0 = Do not check.
1 = First file system (partition) to check, / (root partition) should be set to 1.
2 = ALL OTHER file systems to be checked.


It is strongly advised against to run fsck on a mounted partion, as problems may occur. Fsck will ask you if you want to confirm doing that, and your safest bet is just to avoid doing that at all times