Perform bad blocks scan on root partition in Linux

See Can I run fsck or e2fsck when Linux file system is mounted?, which notes that running any fsck on a mounted filesystem can result in disk or data corruption.

It suggests the following solutions:

A. Take down system to single user mode, unmount system, then run e2fsck

init 1
umount /dev/sda
e2fsck -y /dev/sda3

B. Boot from the installation CD into rescue mode

boot: linux rescue nomount<br/>
mknod /dev/sda
mknod /dev/sda3
fsck /dev/sda3

Another solution would be to use fsck to check the entire disk (except swap) on boot time, as root:

shutdown -Fr now

where -F stands for force fsck check and -r for reboot.


If your init scripts support it (Fedora IIRC), you can add -c -c to /fsckoptions (then create /forcefsck and reboot). Unfortunately, this feature isn't available everywhere. You probably have to reboot to a LiveCD/LiveUSB instead.


You can boot the system and specify init=/bin/bash as boot parameter. This will run bash at boot and not the regular startup scripts. As a result no filesystems are processed and you are left with a read-only root.

Now you have a read-only root and you can fsck it.