How to Fix Bad Sectors in Ubuntu

Techwalla may earn compensation through affiliate links in this story. Learn more about our affiliate and product review process here.
Check your disks for errors to avoid unplanned outages.

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.


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.


Video of the Day

Step 1

Click on the "Applications" menu.

Step 2

Click on the "Accessories" group.

Step 3

Click on the "Terminal" application.


Step 4

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

Step 5

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


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

Step 6

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



Step 7

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 8

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




Report an Issue

screenshot of the current page

Screenshot loading...