A little cheat if your HDD has bad sectors and you don’t want to buy the new one

Hello, reader. This article is not about how to save your HDD or repair it. Instead, if you want to use the old one with bad sectors and don’t want to buy a new one then this article is for you.

Before I start you need to know there is one catch: your bad sectors must be arranged continuously as it is possible and optionally either at the beginnings of HDD(where partitions start, i.e. 2048), somewhere in the middle or at the end. Maybe somebody has already got the idea — we’ll partition HDD using custom sectors not touching bad sectors. For example, you have bad sectors at 159996, 159997, 159998, 159999 from 900000000(and many zeros)+ available sectors. So we can just skip beginning and start our partitions from 160000 (but I recommend to skip another one thousand).

Let’s implement it. We’ll do this by tool called fdisk on Linux. You can just follow steps below and get your result.

First, we need to find our disk. Switch to super user in bash and simply write:

# fdisk -l

That will show us the list of all available disks. Find your disk, let’s take it is /dev/sda.

Then we write:

# fdisk /dev/sda

We set our HDD as an argument for fdisk. Then in the menu of fdisk we just delete all partitions by pressing “d+Enter” combination several times until all partitions are deleted.

Here start the most interesting part: creation of a new partition.

  1. Press “n” button in the menu of fdisk and then choose the type of partition (primary or extended). We choose primary by entering “p”.
  2. Then enter the number of partition. You can just put Enter to set default number that increases continuously starting from 1.
  3. And finally choose First sector from wich our partition will start. As we said above we enter 160000. Press Enter.
  4. Set the end sector. Instead you can just enter the size of partition like: +200G, for 200GiB size of partition. Press Enter.
  5. That’s done! Now your partitions will not intersect with bad sectors.

Example:

Command (m for help): n
Partition type
p primary (3 primary, 0 extended, 1 free)
e extended (container for logical partitions)
Select (default e): p
Selected partition 4
First sector (2048-999999999, default 2048): 160000
Last sector, +sectors or +size{K,M,G,T,P} (2523136-7679999, default 7679999): +200G
Created a new partition 4 of type 'Linux' and of size 200 GiB.

Then you can change the type of partition by pressing t and choosing from the list available types, like 86 — NTFS, b — FAT32 and so on. Press w to write all changes and exit the program. Or you can quite without saving pressing ‘q’. For more options press ‘m’ to show help menu.

That’s all I wanted to show you in this article. Note that it is not the best idea to use such HDD for further use. But it somehow helps to avoid errors and hdd slowdowns trying to access bad sectors. Hope, you’ll find this article interesting and useful. Feel free to leave comments and ask questions.