At boot-time the system checks periodically the integrity of the disks. We could see where was the last check done, by running the below command:


We could also use tune2fsto change the interval between two checks:

  • d : days
  • w : weeks
  • m : months
  • x : integer.
Example :


Instructs the fsck program to do the checking everyday for the /dev/sda3 partition.

The fsck command:

The fsck command works on the ext2,ext3 and ext4 filesystems.
To make sure we have the right filesystem, we use the below command:


Important:

We need to run fsck on an unmounted filesystem.

Checking a filesystem:

We first get the name of our filesystem we want to run fsck on, using the below command:


We unmout /dev/sda3 using the below command:


We then run the fsck command on the /dev/sda3 partition, using:


We use the "-y" to run it in a non-interactive mode.
we can run below command to check the exit status of fsck:


It displays the exit status of the last command (fsck).
  • 0: no errors
  • 1: filesystem error corrected.
There are other exit statuses than the ones above.

We mount back our filesystem:


We check if it was mounted using the below command.


Checking the root partition:

To know the name of the root partition, we run the below command:


The safest way is to use a Live CD like the Fedora Live CD, and to boot from it. 
Then we could run the below command on our root partition /dev/sda1:


And we reboot the system.

Remark:

When we boot from the Live CD, the root filesystem is not  mounted.

Brando Sabatini and Ikbal C ©. Powered by Blogger.