Skip to content

Clear bad sector count on NTFS drive


Here’s my first post.

I’ve recent PV’d a failing server to VMware, however the old server had a 250GB disk but only was using 10GB of it. VMware converter wouldn’t let me re-size the disk so I ended up just doing a full copy, now the disk is a thin disk but is taking up 250GB.
The server only needs a 40GB disk so I tried to shrink it with gparted but I was getting an error about bad sectors, as per the warning message I ran chkdsk /r /f several times but all was ok, however gparted wouldn’t run. I know I could have used ntfsresize -bad-sectors, but I know the disk doesn’t have bad sectors.  This made m start thinking if I could reset the bad sector count on the partition, I’ve written how I did this below.

****Make sure you have a full backup before proceeding****

The instructions below assume the NTFS partition is on /dev/sda1

  1. Download gparted live cd
  2. When the cd has booted click on terminal
  3. type:
    ntfsinfo -i 8 /dev/sda1
  4. The command will output similar to the below screenshotScreenshot 1
  5. Make a note of the Allocated size for the ‘$Bad’ attribute, as indicated by the red line above
  6. type:
    ntfstruncate /dev/sda1 8 0x80 ‘$Bad’ 0
  7. In the next command you will need to use the allocated size form step 5.
  8. type:
    ntfstruncate /dev/sda1 8 0x80 ‘$Bad’ <number from step 5>
    ntfstruncate /dev/sda1 8 0x80 ‘$Bad’ 250048479232
  9. Screen shot of steps 6-8Screenshot 2
  10. You can now size the partition with gparted

I hope others find this useful.



From → VMware

  1. Jason permalink

    I thought I should point out what looks to be a typo in the ntfstruncate command. You’ve written ‘$BAD’, but it should be ‘$Bad’.

    • FeRDNYC permalink

      Recall that NTFS is case-insensitive; I can’t imagine it would care whether the attribute is named ‘$BAD’, ‘$Bad’, or ‘$bAd’.

      • Yes, NTFS is case-insensitve but it’s not NTFS at the block level so it is case sensitive.

  2. Jason permalink

    But, this really helped. I was having the same problem, and this did the trick!

    Thank you!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: