Repair Ubuntu file system errors

On the whole Ubuntu's file system is robust. I can honesty say that in years of using Ubuntu I've never had to manually check the hard disk for errors. Even if the power has suddenly gone off, Ubuntu has booted correctly the next time with no data loss. This is helped by periodic disk checks that run automatically at boot-up.

But if you need to manually check the disk, it's only a single command away. You'll need to boot from your Ubuntu install CD because it's not possible to check a file system while it's in use. Select Try Ubuntu from the install CD-ROM boot menu. When the desktop appears, open a terminal window and type the following:

This assumes that Ubuntu is installed alongside Windows on the hard disk. If it's the only operating system on the disk, replace /dev/sda5 with /dev/sda1.

If there are any errors, you'll be prompted to repair them. Usually you can agree to the repair.

To perform a surface scan for bad blocks in addition to a file system check, add the the -c command option: $ sudo fsck.ext3 -fck /dev/sda5

To fix the Windows (NTFS) file system from within Ubuntu, see Tip 38, on page 98.

Was this article helpful?

0 0

Post a comment