How to Fix Bad Sectors in Ubuntu

If you've ever lost an important file in a hard disk crash, then you know how frustrating the experience can be. Your computer is working fine as you save an important document. When you reboot a few minutes later, the system refuses to come up, leaving you wondering if you'll ever see your files again.

...
Check your disks for errors to avoid unplanned outages.

Fortunately, hard disks often die slowly: individual sectors, the smallest unit of data managed by the disk, begin to fail. When the damage is minor, Ubuntu Linux finds and repairs the corruption automatically. If the disk is badly damaged, however, you'll need to repair the bad sectors manually.

Step

Click on the "Applications" menu.

Step

Click on the "Accessories" group.

Step

Click on the "Terminal" application.

Step

Type the command "mount" and press "Enter."

Step

Choose a filesystem to repair. For example, you might choose the filesystem named "/home" if the output from the "mount" command includes this line:

Step

/dev/mapper/vg0-home on /home type ext3 (rw)

Step

Type the "umount" command to unmount the filesystem. To unmount the "/home" filesystem, for example, issue the command "sudo umount /home".

Step

Type the "fsck" command to repair the filesystem. The "fsck" command stands for "file system check"; it scans the disk for bad sectors and labels the ones that aren't working. To run fsck on the /home filesystem, issue the command "sudo fsck /dev/mapper/vg0-home". Replace "/dev/mapper/vg0-home" with the output from your "mount" command, as appropriate.

Step

Type the "mount" command to remount the repaired filesystem. If you repaired the "/home" filesystem, then use the command "sudo mount /home".