GParted, Why Hast Thou Forsaken Me?

The trouble with using GParted to resize an NTFS partition that has supposedly “bad” sectors (and, finally, a solution!).

UPDATE March 16 2012 – there is finally a solution to this problem – read the updates at the end of this article for details.

Longtime readers will remember the computer drama that unfolded back in May of 2008 when I bought my new 500 GB hard drive. Basically, when I tried to resize my NTFS partitions, GParted (or, more specifically, the tool ntfsresize) said “you’ve got bad sectors on your disk, I’m not touching anything” and refused to run. I eventually lost the battle and settled for a (less than ideal) configuration for my new disk.

Fast-forward to today – the public beta of Windows 7 is meant to come out today, and although there’s always the virtual machine route, for something like this I thought it might be worthwhile to dual-boot so it could have the full power of my machine (Vista under Virtual PC is OK, but sloooooow – imagine what a beta version of an even newer OS would be like?).

Since Microsoft’s web servers seem to be totally overwhelmed with the demand for Windows 7, they’ve taken the download off-line for the time being. So, given that it seems like I might have to wait a bit, I figured I might as well download the latest GParted LiveCD (version 0.4.1-2 in case you’re curious) and make a little partition space available.

As you might imagine from the title of this post, I wasn’t able to do it. It was the same problem as before – there were “bad” sectors on the disk, so ntfsresize refused to do anything. Oh, sure, I could have tried to do it from the command line and used the --bad-sectors option of ntfsresize, but I’m not one for specifying disk sizes based on cluster locations, which is how you’d have to do it. And I couldn’t even get the parameters that the GUI interface would have used when resizing, because it wouldn’t even let me try to resize under the GUI to get the parameters!

After all, what’s the point of a GUI LiveCD if you can’t use the GUI!

What’s even more confusing/infuriating is that every forum post or help document I could find on this subject seems to go like this:

Novice User: I’m getting this “bad sector” warning – but I ran CHKDSK two times like it said, it found no bad sectors (or it found one and repaired it), but I still can’t run ntfsresize!

Linux Guru: Your disk is failing, get a new one.

Novice User: But…


I have, of course, embellished this somewhat for dramatic effect, but you get the idea. The assumption is always that the problem is with the hardware. (Even the Wikipedia article on ntfsresize seems to support this point of view, although in fairness it is marked as [citation needed]!) I can understand a certain amount of healthy skepticism (in many cases bad sectors are a legitimate sign of a dying hard drive), but there seems to be a certain amount of… I don’t know, denial – for lack of a better word – going on with respect to bad sectors that aren’t actually all that “bad.”

If your hard drive develops a bad sector (as a result of a sudden power loss situation, for example – which is what caused my bad sectors), CHKDSK for Windows will find the problem, recover what data it can, and mark the sector as “bad” so it doesn’t get used again. Barring another power loss situation (fixed for me since I now have a UPS for my computer), the drive should be just fine for the rest of its natural life.

Likewise with defects that were detected by the manufacturer (but not bad enough to reject the disk over) and marked as “bad” before they left the factory. I know they used to do this with disks – I assume they still do.

So, it certainly seems like there are situations (possibly quite common) where a drive will have “bad” sectors, but should still be safe to use and operate on. After all, the fact that they were marked “bad” means that they were detected and won’t be used again.

Of course, I do have to mention again that ntfsresize has a --bad-sectors option which will ignore bad sectors… but there’s no way to access this option from the GParted GUI. You HAVE to do it from the command line – which kind of defeats the point. The whole wonderful thing about GParted in the first place is that it’s a graphical way to resize your disk partitions. I’m a geek, but even I don’t like to have to specify partition sizes by sector/cylinder offsets.

So, if you were to ask me, I’d say that either:

  • ntfsresize should be a little more forgiving regarding bad sectors; or
  • The GParted UI should detect the ntfsresize error and allow the user to proceed with the --bad-sectors option, obviously with a stern warning about making sure you’ve checked the disk thoughougly with CHKDSK or some other tool to make sure there are no further problems and the drive isn’t failing even more.

I know this post ended up being sort of just me whining – but I do wish that I could resize my disks with GParted. I like GParted – I think it’s a great tool – but, unfortunately, it’s just not a tool I can use anymore.

If anyone has any tips or ideas on how I might be able to work around this limitation – or of perhaps another partition-resizing tool (free and/or open source preferred, of course!), I’d love to hear from you – feel free to speak up in the comments!

UPDATE: I’ve found a program called EASEUS Partition Manager – it’s free for the “home” edition. (But not open-source, unfortunately.) I’ll update with a new post if I’m able to resize my partition, but first I need to do a full backup, just in case!

UPDATE 2: Follow up article here – the news isn’t good, I’m afraid.

UPDATE 3: A very nice reader emailed me to point me to this solution from Unfinished Teleporter: Gparted won’t shrink an NTFS partition with a bad sector.

Basically, you create an executable bash script which adds the --bad-sectors option to the original ntfsresize program. You can see the steps in the article I linked above, or follow these general steps:

  1. Locate the ntfsresize executable (for the GParted live CD it will be in /usr/bin, for Parted Magic it is in /usr/sbin).
  2. Rename it to ntfsresize.orig.
  3. Create a new bash script at the same location named ntfsresize. (See below for what you should put in this script.)
  4. Use chmod to ensure the new script is executable (chmod 755 will do the trick).
  5. Run GParted as normal.  It will ignore the bad sector(s).

In the bash script itself, you’ll want to add these two lines:

exec ntfsresize.orig --bad-sectors "$@"

This will call the original ntfsresize that you renamed, tack on the --bad-sectors option, and then pass whatever other options GParted (or whatever you are using) called it with originally.

I haven’t been able to try this myself (I’ve long since upgraded to another, newer computer), but I’ve been told this works like a charm. So if you are having this same sort of problem, give this a try!

Of course, before doing this you should be sure you’ve backed up all your data, since this is technically overriding a fail-safe feature of ntfsresize.

Anyway, I hope someone finds this useful – and thanks again to that very nice reader who pointed out this solution to me!

Author: Keith Survell

A geek, programmer, amateur photographer, anime fan and crazy rabbit person.

4 thoughts on “GParted, Why Hast Thou Forsaken Me?”

  1. Hello,

    I found your website because I was seeking a solution to the same problem you have listed here.

    I wanted to let you know that I discovered a way to get around this problem. I was running GParted so that I could create another partition and got the same results: lots of bad sectors. I let it run until it just creeped to a halt and froze on one bad sector, at which point I hit “Ctrl + C” (the old DOS command for cancel). This cancelled out of the scan and let the program proceed into the GUI screen where I resized the partitions with no problems at all.

    Try this and see if it works for you.

    I hope this helps someone out.

    1. Sadly, that won’t work in my situation, as GParted REFUSES to run at all, since there were previously detected “bad sectors” on the hard drive (even though those bad sectors were fixed/marked off by chkdsk). So there’s never even a chance to “let it run until it just creeped to a halt and froze on one bad sector,” because it isn’t even getting that far.

      This is more a problem with GParted deciding that ANY bad sectors that were found on a hard drive – even if they are months or even years old – automatically means the hard drive is failing and it refuses to touch it.

  2. Sigh – I am in the same boat here with 2 bad sectors. I agree, I just want to take my changes and resize the partitions. I am out of luck for now I suppose.

    I have also done the chkdsk /f /r and rebooted twice… same ole story… I have 2 bad sectors and GPArted won’t run until fixed…. arrrrg.


  3. Same problem here – GParted refuses to touch the drive I’m using because it has (corrected) errors. What’s particularly annoying is that I’m building a system where reliability just isn’t that critical… if the disk blows up, no big deal – so GParted *should* offer me the ‘bad-sectors’ option that ntfsresize gives.

Comments are closed.