Linux 101 : Disk repair/Check - fsck and tune2fs commands-
We could also use tune2fs, to 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:
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 use the "-y" to run it in a non-interactive mode.
we can run below command to check the exit status of fsck:
we can run below command to check the exit status of fsck:
- 0: no errors
- 1: filesystem error corrected.
We mount back our filesystem:
Checking the root partition:
To know the name of the root partition, we run the below command:
Then we could run the below command on our root partition /dev/sda1:
Remark:
When we boot from the Live CD, the root filesystem is not mounted.
Comments