Over the last couple of years I have come across a lot of drives with bad sectors. Sometimes these can be fixed just using chkdsk /R in Windows Recovery, but sometimes the error seems to be much ‘deeper’ and nothing much seems to fix it. If the drive really is faulty, or you just want to upgrade it or repartition it, bad sectors can be a real problem.
First issue is actually cloning a hard drive with bad sectors. My cloning tool of choice is Cloneziilla, which is free and reasonably straightforward to use. However in beginners mode, it too will fail on a disk with bad sectors. The solution here is to use Clonezilla in expert mode, which is not as daunting as it sounds. Just read the options carefully, and it quickly becomes apparent that ticking the appropriate option (-rescue I think) will ignore bad sectors. Cloning will now take place, but if there are many bad sectors (as with a physically damaged disc) this could take a long time.
The second problem occurs with the cloned partition, which will have ‘cloned bad sectors’, not really bad, but the HDD is pretty convinced they are. Unless you want an identically sized partition, you will need to resize the partition, and I do this by booting into a live disc copy of Ubuntu. In ubuntu the tool to edit partitions is called Partition Editor, or Gparted depending on which flavour of Ubuntu you are using. This tool allows simple resizing of partions, EXCEPT when the partition has bad sectors, including cloned bad sectors.
Gparted uses NTFSRESIZE to resize NTFS partitions, and while native NTFSRESIZE has the ability to ignore bad sectors, this is not included in Gparted, so Gparted always fail to resize partitions with bad sectors. I searched for weeks to find a solution to this one, and here it is. This is a really dangerous fix, so don’t mess about with your only copy of a disk, clone it first and work on the clone. As I was cloning the partittion, I was already in that position. THe description in the page is a little technical, and everything can be done by using the Ubuntu gui front end. I do this in the Ubuntu live disc boot, so none of this is permanent, so I have to do it each time. Here is the list of actions I take.
In a terminal window (Accessories/terminal) type Sudo Nautilus
In nautilus drill down into /usr/sbin, and rename NTFSRESIZE to NTFSRESIZE.orig by rightclicking on it and choosing rename.
In nautilus rightclick between file icons and choose create document, and name the new file NTFSRESIZE
Right click on the new file, click on Properties, and then select Permissions, and tick the make executable option
Open the empty file, and add the lines
exec ntfsresize.orig –bad-sectors “$@”
(that is two hyphens before the word bad, some browsers may show it as an m-dash rather than two 2 n-dashes)
and save the file.
Now restart Gparted, and select the offending partition, and resize it. Gparted will throw up an error or warning about bad sectors, but will complete the task. All we have done here is basically added the –bad-sectors parameter to any call of NTFSRESIZE, which is now just a script that calls the original NTFSRESIZE with the parameter added. It is a very clever workaround, and I am very grateful to the original poster. This post is just spreading the word, and if you happen upon this post, please use and enjoy if this is what you are looking for.