User Tools

Site Tools


If you want to send us your comments, please do so. Thanks
More on comments

Check disks and filesystems

e2fsck general

A swap partition can not be tested
The /tmp partition test will complain about the omission of the lost+found directory. Do not have it created

Check for bad blocks

This also works on a fully wiped hard disk without any filesystem. Like a disk filled with 0x00's
If there are partitions on the drive you need to test them one by one. e2fsck -c /dev/sda* does not work

When a bad block is found cancel (CTRL-c) e2fsck or mkfs.ext4 and use an other tool like Spinrite to try to recover the data

When testing a SSD only use one -c since a double -c -c (read and write test) will wear the drive. Use -c -c only if you really want to test the write ability of the SSD

e2fsck -c -c -v -f /dev/sda
mkfs.ext4 -c -c -v -f /dev/sda

Check filesystem

Use e2fsck to check and repair a Linux filesystem like ext2, ext3, ext4
Make sure the filesystem is unmounted

-cCheck for bad blocks, read only
-ccCheck for bad blocks, read write
-CDisplay completion/progress bars for those filesystem checkers (currently only for ext[234]) which support them
-fForce checking even if the file system seems clean
-nOpen the filesystem read-only. For non interactive use. -p and -y options are not permitted
-pAutomatically repair. -n and -y options are not permitted
-tPrint timing statistics
-ttPrint timing statistics on a pass by pass base
-yAssume an answer of `yes' to all questions. This allows e2fsck to be used non-interactively like with cron. It is forbidden to use this option at the same time as the -n or -p options


e2fsck -v -t /dev/sda1

In cron use (make sure the filesystem is unmounted)

e2fsck -n -v -t /dev/sda1


Use fsck to check and repair a Linux filesystem like ext2, ext3, ext4. Example

fsck -C -l -r -V -t ext4 /dev/sda1


Use dosfsck = fsck.msdos = fsck.vfat to check and repair MS-DOS filesystems like vfat

-aAutomatically repair the filesystem. No user intervention is necessary. Whenever there is more than one method to solve a problem, the least destructive approach is used
-bMake read-only boot sector check
-fSalvage unused cluster chains to files. By default, unused clusters are added to the free disk space except in auto mode (-a)
-lList path names of files being processed
-rInteractively repair the filesystem. The user is asked for advice whenever there is more than one approach to fix an inconsistency. This is the default mode and the option is only retained for backwards compatibility
-tMark unreadable clusters as bad
-vVerbose mode. Generates slightly more output
-VPerform a verification pass. The filesystem check is repeated after the first run. The second pass should never report any fixable errors. It may take considerably longer than the first pass, because the first pass may have generated long list of modifications that have to be scanned for each disk read.
-wWrite changes to disk immediately
-ySame as -a (automatically repair filesystem) for compatibility with other fsck tools

[device] is something like sde

dosfsck -bflrtv /dev/[device]

Main subjects on this wiki: Linux, Debian, HTML, Microcontrollers, Privacy

Privacy statement
Bugs statement
Copyright © : 2014 - 2022 and the authors
Changes reserved.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
check_disks_and_filesystems.txt · Last modified: 16-12-2021 08:52 by wim