Difference between revisions of "Fsck"
From Notes_Wiki
m |
m |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Filesystem or partition tools]] > [[Fsck]] | |||
=Checking ext3 partitions for disk errors= | =Checking ext3 partitions for disk errors= | ||
Line 22: | Line 21: | ||
< | |||
==Automatically answer to fsck prompts== | |||
fsck can automatically repair issues using '<tt>fsck -a</tt>' or <tt>fsck -p</tt>. However, if repair is likely to be destructive error would be shown and we need to run with -a and -p and manually enter yes/no for prompts. Thus, it is better to use | |||
<pre> | |||
fsck -y | |||
</pre> | |||
which answers y for all prompts and does not requires human intervention. -y cannot be used along with -a or -p | |||
==Force check of clean file-system== | |||
If the filesystem is clean and check should be forced use -f | |||
==Recommended options- Scan bad blocks, default yes and force scan== | |||
If not sure which options should be used, then: | |||
<pre> | |||
fsck -cyf | |||
</pre> | |||
should be fine in most cases | |||
Refer: | |||
* https://unix.stackexchange.com/questions/347280/how-to-perform-full-check-of-ext4-file-system-structure | |||
* https://askubuntu.com/questions/14740/force-fsck-ext4-on-reboot-but-really-forceful | |||
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Filesystem or partition tools]] > [[Fsck]] |
Latest revision as of 13:43, 24 August 2022
Home > CentOS > CentOS 6.x > Filesystem or partition tools > Fsck
Checking ext3 partitions for disk errors
We can use following command to check ext3 partitions for disk errors / surface scan for bad blocks:
e2fsck -c -c -k -v -C 0 <partition_device_name>
Here:
- -c : To call badblocks for surface scan
- -c : Repeated to indicate non-destructive read-write tests
- -k : Preserve previous list of bad blocks
- -v : Verbose
- -C 0 : To print progress on file descriptor. For some strange reason 0 causes output to be sent on screen.
Note:
- It is advisable to use e2fsck in above format so that it calls 'badblocks' internally, and we should avoid calling program badblocks directly.
Automatically answer to fsck prompts
fsck can automatically repair issues using 'fsck -a' or fsck -p. However, if repair is likely to be destructive error would be shown and we need to run with -a and -p and manually enter yes/no for prompts. Thus, it is better to use
fsck -y
which answers y for all prompts and does not requires human intervention. -y cannot be used along with -a or -p
Force check of clean file-system
If the filesystem is clean and check should be forced use -f
Recommended options- Scan bad blocks, default yes and force scan
If not sure which options should be used, then:
fsck -cyf
should be fine in most cases
Refer:
- https://unix.stackexchange.com/questions/347280/how-to-perform-full-check-of-ext4-file-system-structure
- https://askubuntu.com/questions/14740/force-fsck-ext4-on-reboot-but-really-forceful
Home > CentOS > CentOS 6.x > Filesystem or partition tools > Fsck