Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: Howto: Use ntfsresize+fdisk to resize a partition with bad sectors

  1. #11
    Join Date
    Apr 2009

    Re: Howto: Use ntfsresize+fdisk to resize a partition with bad sectors

    Quote Originally Posted by LindaBW View Post
    Hi Phineas,

    Nothing like that happened to me. One thing to check is to make sure you have the "boot" flag on for the Windows partition. To check this, enter fdisk, and type "p" to see the partition table. The second column in the partition table is the "Boot" column. If a partition has an asterisk in this column, it means the partition is bootable. If there is no asterisk, you can use the "a" command to toggle the flag as described above.

    If the boot flag is already on, I don't have any more ideas for what might be wrong -- I'm a novice at this myself. If you have a log of the actions you took, posting that might help a more experienced user diagnose the problem. (If you didn't know, it's very easy to preserve logs of your command line operations before you exit Parted Magic and lose everything. Just open a text editor in the Parted Magic OS (it has one), copy paste everything from your terminal into that, and then save the file to an external disk such as a flash drive.)

    Thanks a lot. It's partitioning now. Hopefully I won't get a boot error, but either way your tutorial helped me out.

    Thanks again!

  2. #12
    Join Date
    May 2010

    Re: Howto: Use ntfsresize+fdisk to resize a partition with bad sectors

    scanning these posts I wondered whether anybody has seen the following problem and found a solution or can explain what is happening:

    I am having some inconsistencies when running my Vaio Laptop under WinXP and/or under Wubi 10.04.2 (double boot). Chkdsk does not find any error but gparted and ntfsresize complain about at least 2 defective sectors. I did as indicated in these posts (i.e. run chkdsk /r /f twice on c: and d: and also run ntfsresize with the parameters set to correct bad sectors) but the error shown in gparted did not go away. I also run the Seegate HD tool under WinXP and it did not report any HD error. So, is there a defective sector or not?
    Thanks for hints, DE

  3. #13
    Join Date
    Apr 2012

    Thumbs down Re: Howto: Use ntfsresize+fdisk to resize a partition with bad sectors

    This worked great but it seems to be a lot of steps and a lot of things to keep track of. I found a much simpler way and it can all be done through gparted. I cannot take credit for this but I have tested it and it works great.


    Basically, you create an executable bash script which adds the --bad-sectors option to the original ntfsresize program. You can 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). (/sbin for ubuntu)
    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 "$@"

    I did all the moving and script creating with the sudo command as to keep permissions as root.

    Now I don't even have to think about it, I just launch gparted and no bad sector error.

  4. #14
    Join Date
    Jul 2012

    Re: Howto: Use ntfsresize+fdisk to resize a partition with bad sectors


    I can't thank you enough for this wonderful and helpful posts. Three years later it's still useful. I had problems too with a bad sector, so Gparted wouldn't work at all. Your guide was of invaluable help, since I didn't want to deal with ntfsresize or fdisk, since it seemed too difficult. Your guide gave me confidence.

    But, as MWola, I'd like to do some remarks, hoping this could help somebody else too. When creating the new partition in fdisk, the one with:

    Command (m for help): n 
    Command action
        e   extended 
          p   primary partition (1-4) 
    Partition number (1-4): 2
    First cylinder (11-4864, default 11): 11 
    Last cylinder, +cylinders or +size{K,M,G} (11-4864, default 4864): +19000M
    It asked me for sectors, not cylinders. People doing this should be very careful with this point. To my knowledge, by default the unit measure is given in sectors, until you specify it otherwise. If for some reason, in the step above fdisk ask you for an unit different than given in the partition table, as MWola suggest, open an alternate terminal (ctrl+alt+t) and type:

    fdisk -l -u='sectors'
    Or change 'sectors' for 'cylinders', as required, and copy the value. I was given and asked everything in sectors, so I didn't have that issue.

    But what confused me is that when asked for the first sector, the default given didn't correspond to the original partition table. This confused me a lot, and for a moment I thought of entering the default given. I realized there was a reason for you constantly keeping track of the original partition table, and I decided to enter the first sector given in the original partition table, NOT the default suggested. Everything else went as shown, and now I'm typing this on my new Ubuntu system. Thank you so much.

    In short. keep track of if fdisk is asking you for cylinders or sectors, and enter the first sector or cylinder for the required partition given in the ORIGINAL partition table, regardless of what fdisk may have as default.
    Last edited by Analogon; July 24th, 2012 at 05:54 PM. Reason: formatting

Page 2 of 2 FirstFirst 12

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts