1

So, lately I've been having issues booting up Ubuntu and having to go into grub and do a recovery boot and I'll have issues saying "i/o errors in dev/sda" or something along those lines and I noticed I have 113 have bad sectors in my HDD when I just recently started the Disks setting. Isn't there a way to block out those bad sectors or something? What should I do? Thank you!

  • 1
    Make a backup and ensure you can restore from it. Then you can start playing games with the disk. – ubfan1 Nov 17 '14 at 1:07
  • As funny as that is, I just bought this hard drive like 3 months ago and I just recently built this computer. So, it's sort of a bumber. – durango Nov 17 '14 at 2:11
  • I understand that. Same thing has happened to me before. It's not fun. – Kaz Wolfe Nov 17 '14 at 5:27
6

With bad sectors, you should always immediately backup all important information and get a new hard drive. You can theoretically mark these sectors as "bad" and tell the computer not to use them. However, this is not at all recommended as bad sectors like spreading like a fungus.

If you want to try this, instructions are below.

  1. Find your hard drive with lsblk. Find the EXT partition mounted at /.
  2. Remember the code. It should look something like /dev/sda1.
  3. Strip the number off the code you got earlier. If you had /dev/sda1, your code is now /dev/sda.
  4. Run this command: sudo badblocks /dev/sdc > /home/$USER/bad-blocks
  5. Run this command: sudo fsck -l bad-blocks /dev/sdc
  6. While running the above commands, go take a walk. Do not touch your computer.

Disclaimer: I am not responsible for any loss of data or system damage that has resulted from the above commands, both instant and in the future. I hold no responsibility for what you type into your terminal. You have been warned.

  • This is exactly what I wanted to hear. Thank you very much! I have a backup already,so I should be good. Thank you! – durango Nov 17 '14 at 2:05
  • @durango If this solved your problem, please hit that green checkmark. It helps the community, you, and me. Everyone wins! – Kaz Wolfe Nov 17 '14 at 2:07
  • 1
    You should not be using the bad blocks list on modern hard disks. These days the disk itself internally remaps bad sectors to a pool of spare good sectors. – psusi Nov 17 '14 at 2:46
  • @psusi That forces the process to take place. I recommend not even working with a bad HDD in the first place. – Kaz Wolfe Nov 17 '14 at 5:21
  • 1
    No... badblocks just tries to read each sector and writes a list of which ones failed to stdout. fsck -l creates an invisible "bad blocks" file uses those bad blocks so that no other file will use them. – psusi Nov 17 '14 at 18:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.