What can be harmed by incorrect power off, and what can be checked?

The easiest way to check the ext4 file system is to add

fsck.mode=force

as a boot parameter.

It can be done in /etc/default/grub, or manually on boot.

For older systems that use upstart run

sudo touch /forcefsck

and reboot.

The command will create an empty /forcefsck file that will tell the system to check drives on boot.

On boot, before the file system is mounted fsck will run and show if there are errors.

Otherwise you will need to boot from some external device.


Ubuntu's standard ext4 file system in an Ubuntu standard partition can be checked with the following command

sudo e2fsck -f /dev/sdxn

or if you also want to check for bad blocks (physically bad blocks)

sudo e2fsck -cf /dev/sdxn

where x is the drive letter and n is the partition number, for example /dev/sda1.

See man e2fsck for details.

You should boot from another drive, a live drive, for example a rescue linux drive or an Ubuntu desktop live drive, and the target partition should not be mounted when you run this command.