1 (edited by pablokal 2011-04-10 00:04:04)

Topic: [Solved]Error when resizing ntfs partition using gparted 0.8.0

Error message:
shrink partition from 293.02 GiB to 263.13 GiB  00:00:03    ( SUCCESS )
            old start: 413416773
old end: 1027919024
old size: 614502252 (293.02 GiB)
new start: 413416773
new end: 965240831
new size: 551824059 (263.13 GiB)

check file system on /dev/sda5 for errors and (if possible) fix them  00:00:00    ( ERROR )
            ntfsresize -P -i -f -v /dev/sda5
            ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/sda5
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 314625151488 bytes (314626 MB)
Current device size: 282533918208 bytes (282534 MB)
ERROR: Current NTFS volume size is bigger than the device size!
Corrupt partition table or incorrect device partitioning?


grow file system to fill the partition  00:00:01    ( ERROR )
            run simulation  00:00:01    ( ERROR )
            ntfsresize -P --force /dev/sda5 --no-action
            ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/sda5
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 314625151488 bytes (314626 MB)
Current device size: 282533918208 bytes (282534 MB)
ERROR: Current NTFS volume size is bigger than the device size!
Corrupt partition table or incorrect device partitioning?

Using GPatred 0.8.0

Tried the tutorial http://gparted-forum.surf4.info/viewtopic.php?id=13937
size 551824059-1=551824058
hex value: 20e42aba
wrote pbr of sda5: dd if=/dev/sda5 of=/home/paul/myCurrentPbr.pbr bs=512 count=1 skip=63

changed in pbr file with hexedit (third line third column)
wrote back: dd if=/home/paul/myCurrentPbr.pbr of=/dev/sda5 bs=512 count=1 seek=63
and rebooted; problem persists

Error Thunar:
Error mounting: mount exited with exit code 12: Failed to read last sector (614502251): Invalid argument
HINTS: Either the volume is a RAID/LDM but it wasn't setup yet,
   or it was not setup correctly (e.g. by not using mdadm --build ...),
   or a wrong device is tried to be mounted,
   or the partition table is corrupt (partition is smaller than NTFS),
   or the NTFS boot sector is corrupt (NTFS size is not valid).
Failed to mount '/dev/sda5': Invalid argument
=====================

root@archbang paul]# parted /dev/sda5 unit s print
Model: ATA WDC WD10EARS-00Y (scsi)
Disk /dev/sda: 1953525168s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start        End          Size         Type      File system     Flags
1      2048s        206847s      204800s      primary   ntfs            boot
2      208845s      413416709s   413207865s   primary   ntfs
4      413416771s   1951415549s  1537998779s  extended                  lba
5      413416773s   965240831s   551824059s   logical   ntfs
6      1027919088s  1052980424s  25061337s    logical   ext4
7      1052980488s  1064691809s  11711322s    logical   linux-swap(v1)
8      1064691873s  1103761889s  39070017s    logical   ext4
9      1103761953s  1181885984s  78124032s    logical   ext4
10      1181886048s  1220956064s  39070017s    logical   ext4
11      1220956128s  1283770214s  62814087s    logical   ext4
13      1283770278s  1335451319s  51681042s    logical   ext4
14      1335451383s  1409045084s  73593702s    logical   ext4
15      1409045148s  1499410709s  90365562s    logical   ext4
16      1499410773s  1884649409s  385238637s   logical   ext4
12      1884649473s  1951415549s  66766077s    logical   ext4
3      1951422464s  1953521663s  2099200s     primary   ntfs            diag

[root@archbang paul]# echo "obase=16;551824058"|bc
bash: bc: command not found
[root@archbang paul]# fdisk -l -u

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x8d9e96fe

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      206847      102400    7  HPFS/NTFS/exFAT
/dev/sda2          208845   413416709   206603932+   7  HPFS/NTFS/exFAT
/dev/sda3      1951422464  1953521663     1049600   12  Compaq diagnostics
/dev/sda4       413416771  1951415549   768999389+   f  W95 Ext'd (LBA)
/dev/sda5       413416773   965240831   275912029+   7  HPFS/NTFS/exFAT
/dev/sda6      1027919088  1052980424    12530668+  83  Linux
/dev/sda7      1052980488  1064691809     5855661   82  Linux swap / Solaris
/dev/sda8      1064691873  1103761889    19535008+  83  Linux
/dev/sda9      1103761953  1181885984    39062016   83  Linux
/dev/sda10     1181886048  1220956064    19535008+  83  Linux
/dev/sda11     1220956128  1283770214    31407043+  83  Linux
/dev/sda12     1884649473  1951415549    33383038+  83  Linux
/dev/sda13     1283770278  1335451319    25840521   83  Linux
/dev/sda14     1335451383  1409045084    36796851   83  Linux
/dev/sda15     1409045148  1499410709    45182781   83  Linux
/dev/sda16     1499410773  1884649409   192619318+  83  Linux

Partition table entries are not in disk order

Additional inf with sudo testdisk /list
Disk /dev/sda - 1000 GB / 931 GiB - CHS 121601 255 63
     Partition            Start        End    Size in sectors
1 * HPFS - NTFS              0  32 33    12 223 19     204800 [System Reserved]
2 P HPFS - NTFS             13   0  1 25733 254 63  413207865 [Boot]
3 P Compaq Diagnostics   121470 109 48 121601  25 24    2099200
4 E extended LBA         25734   0 62 121469 254 63 1537998779
Error: size boot_sector 614502252 > partition 551824059
Invalid NTFS or EXFAT boot
5 L HPFS - NTFS          25734   1  1 60083 118  3  551824059
5 L HPFS - NTFS          25734   1  1 60083 118  3  551824059
   X extended             63985   0  1 65544 254 63   25061400
6 L Linux                63985   1  1 65544 254 63   25061337
   X extended             65545   0  1 66273 254 63   11711385
7 L Linux Swap           65545   1  1 66273 254 63   11711322
   X extended             66274   0  1 68705 254 63   39070080
8 L Linux                66274   1  1 68705 254 63   39070017
   X extended             68706   0  1 73568 254 63   78124095
9 L Linux                68706   1  1 73568 254 63   78124032
   X extended             73569   0  1 76000 254 63   39070080
10 L Linux                73569   1  1 76000 254 63   39070017
   X extended             76001   0  1 79910 254 63   62814150
11 L Linux                76001   1  1 79910 254 63   62814087
   X extended             117314   0  1 121469 254 63   66766140
12 L Linux                117314   1  1 121469 254 63   66766077 [backup]
   X extended             79911   0  1 83127 254 63   51681105
13 L Linux                79911   1  1 83127 254 63   51681042
   X extended             83128   0  1 87708 254 63   73593765
14 L Linux                83128   1  1 87708 254 63   73593702 [Archb05]
   X extended             87709   0  1 93333 254 63   90365625
15 L Linux                87709   1  1 93333 254 63   90365562 [chakra]
   X extended             93334   0  1 117313 254 63  385238700
16 L Linux                93334   1  1 117313 254 63  385238637 [depot]
Disk /dev/sr0 - 353 MB / 337 MiB - CHS 172695 1 1
     Partition            Start        End    Size in sectors

Partition sector doesn't have the endmark 0xAA55

2

Re: [Solved]Error when resizing ntfs partition using gparted 0.8.0

pablokal wrote:

Tried the tutorial http://gparted-forum.surf4.info/viewtopic.php?id=13937
size 551824059-1=551824058
hex value: 20e42aba
wrote pbr of sda5: dd if=/dev/sda5 of=/home/paul/myCurrentPbr.pbr bs=512 count=1 skip=63


changed in pbr file with hexedit (third line third column)
wrote back: dd if=/home/paul/myCurrentPbr.pbr of=/dev/sda5 bs=512 count=1 seek=63
and rebooted; problem persists

You were close, but the offset value you used for sda5 is incorrect.

The PBR for sda5 is not located at sector 63.  From the fdisk output, the PBR for sda5 is located at sector 413416773.

Hence I recommend that you restore sector 63 to the original backup copy you made.  Then you can use the tutorial to set the value at sector offset 413416773.

3 (edited by pablokal 2011-04-06 20:29:48)

Re: [Solved]Error when resizing ntfs partition using gparted 0.8.0

Thanks for your response. I really had an off day.
I seem to have forgotten to make a backup of the original myCurrentPBR.pbr.
Only have the changed pbr left.
What is the best option to proceed now?

the line is reading now:
00000020   10 27 11 27  12 27 13 27  20 E4 2A BA  16 27 17 27

Edit: tried to restore the pbr of sda5 with :
dd if=/dev/sda5 of=/home/paul/myCurrentPbr_sda5.pbr bs=512 count=1 skip=413416773
Making a copy of it (try to learn from my mistakes)
changing the hexedit value to 20 E4 2A BA  third column third line and
dd if=/home/paul/myCurrentPbr_sda5.pbr of=/dev/sda5 bs=512 count=1 seek=413416773 
This repaired nothing. Was it unwise to do this? I can change it back now.


Btw I forgot to tell how all this happened in the first place: I was partitioning from a linux Arch system on sda11 another part of the extended partition, that was resizing the ntfs partition sda5.
Should have done this from a live CD of course, but on the other hand strange that gparted let me get away with it.

4

Re: [Solved]Error when resizing ntfs partition using gparted 0.8.0

pablokal wrote:

the line is reading now:
00000020   10 27 11 27  12 27 13 27  20 E4 2A BA  16 27 17 27

You are almost there.  All that is needed is to reverse the order of the bytes.  The line should read:

00000020   10 27 11 27  12 27 13 27  BA 2A E4 20  16 27 17 27

As for the original sector 63 you should not need to worry too much about it because your first partition begins at sector 2048.  There might or might not be boot code stored in the sector.  If you computer boots properly then sector 63 should be fine.

5 (edited by pablokal 2011-04-08 00:54:46)

Re: [Solved]Error when resizing ntfs partition using gparted 0.8.0

Ok did as you told, but still after reboot can't mount or explore sda5

Checking it with gparted gave this error:
GParted 0.5.1

Libparted 2.2

Check and repair file system (ntfs) on /dev/sda5  00:00:01    ( ERROR )
       
calibrate /dev/sda5  00:00:01    ( SUCCESS )
       
path: /dev/sda5
start: 413416773
end: 965240831
size: 551824059 (263.13 GiB)
check file system on /dev/sda5 for errors and (if possible) fix them  00:00:00    ( ERROR )
       
ntfsresize -P -i -f -v /dev/sda5
       
ntfsresize v2.0.0 (libntfs 10:0:0)
Device name : /dev/sda5
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 314625151488 bytes (314626 MB)
Current device size: 282533918208 bytes (282534 MB)
ERROR: Current NTFS volume size is bigger than the device size!
Corrupt partition table or incorrect device partitioning?

And same error with testdisk:
Error: size boot_sector 614502252 > partition 551824059
Invalid NTFS or EXFAT boot

6

Re: [Solved]Error when resizing ntfs partition using gparted 0.8.0

Let's start from scratch on this one.

First, grab a copy of the latest GParted Live because the resize problem is prevalent when using GParted with libparted 2.2.

Second, please provide the output for the following two commands:

fdisk -l -u

where one of the options is a lower case "L" and not the number one.

parted /path-to-your-device unit s print

where /path-to-your-device is something like /dev/sda.

Third, assuming that sda5 still begins on sector 413416773, provide copies of the MBR and PBR as follows:

You can capture the Master Boot Record in a file with the following command:

NOTE:  Be extra careful to type this command in properly, otherwise loss of data could result.

dd if=/dev/sda of=sda-pablokal.mbr bs=512 count=1

where sda-pablokal.mbr is the name of the file that will need to be uploaded.


You can capture the NTFS Partition Boot Record in a file with the following command:

NOTE:  Be extra careful to type this command in properly, otherwise loss of data could result.

dd if=/dev/sda of=sda5-pablokal.pbr bs=512 count=1 skip=413416773

where sda5-pablokal.pbr is the name of the file that will need to be uploaded.


Then upload these files to a media sharing site, such as mediafire or filefactory, and post the link to these files in this forum post.

7

Re: [Solved]Error when resizing ntfs partition using gparted 0.8.0

sudo fdisk -l -u

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x8d9e96fe

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      206847      102400    7  HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sda2          208845   413416709   206603932+   7  HPFS/NTFS
/dev/sda3      1951422464  1953521663     1049600   12  Compaq diagnostics
/dev/sda4       413416771  1951415549   768999389+   f  W95 Ext'd (LBA)
/dev/sda5       413416773   965240831   275912029+   7  HPFS/NTFS
/dev/sda6      1027919088  1052980424    12530668+  83  Linux
/dev/sda7      1052980488  1064691809     5855661   82  Linux swap / Solaris
/dev/sda8      1064691873  1103761889    19535008+  83  Linux
/dev/sda9      1103761953  1181885984    39062016   83  Linux
/dev/sda10     1181886048  1220956064    19535008+  83  Linux
/dev/sda11     1220956128  1283770214    31407043+  83  Linux
/dev/sda12     1884649473  1951415549    33383038+  83  Linux
/dev/sda13     1283770278  1335451319    25840521   83  Linux
/dev/sda14     1335451383  1409045084    36796851   83  Linux
/dev/sda15     1409045148  1499410709    45182781   83  Linux
/dev/sda16     1499410773  1884649409   192619318+  83  Linux

Partition table entries are not in disk order
=============

sudo parted /dev/sda unit s print
Model: ATA WDC WD10EARS-00Y (scsi)
Disk /dev/sda: 1953525168s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start        End          Size         Type      File system     Flags
1      2048s        206847s      204800s      primary   ntfs            boot
2      208845s      413416709s   413207865s   primary   ntfs
4      413416771s   1951415549s  1537998779s  extended                  lba
5      413416773s   965240831s   551824059s   logical   ntfs
6      1027919088s  1052980424s  25061337s    logical   ext4
7      1052980488s  1064691809s  11711322s    logical   linux-swap(v1)
8      1064691873s  1103761889s  39070017s    logical   ext4
9      1103761953s  1181885984s  78124032s    logical   ext4
10      1181886048s  1220956064s  39070017s    logical   ext4
11      1220956128s  1283770214s  62814087s    logical   ext4
13      1283770278s  1335451319s  51681042s    logical   ext4
14      1335451383s  1409045084s  73593702s    logical   ext4
15      1409045148s  1499410709s  90365562s    logical   ext4
16      1499410773s  1884649409s  385238637s   logical   ext4
12      1884649473s  1951415549s  66766077s    logical   ext4
3      1951422464s  1953521663s  2099200s     primary   ntfs

================
pablokal.pbr
http://www.mediafire.com/download.php?1ybdvxxw4cvwhti
pablokal.mbr:
http://www.mediafire.com/download.php?54qq2k2j487wjjp

I want to thank you explicitly for all your efforts; this is very much appreciated.
I think the mbr is incongruous with the pbr.

8

Re: [Solved]Error when resizing ntfs partition using gparted 0.8.0

Since you were trying to shrink the partition, we will decrease the NTFS volume size to fit within the partition.

The change I have made to the file is from a length of 614,502,251 sectors:
00000020   00 00 00 00  80 00 80 00  6B 8F A0 24  00 00 00 00
To a new length of 551,824,058 sectors:
00000020   00 00 00 00  80 00 80 00  BA 2A E4 20  00 00 00 00

Note:  The NTFS volume size is always 1 sector less than the total number of sectors in the partition table entry because the NTFS backup sector is not considered part of the NTFS volume.

To apply this change:

1) Download the new NTFS PBR: sda5-pablokal_new.pbr

2) Load the new NTFS PBR on your hard disk.
NOTE:  Be extra careful when entering the commands.  Data loss could result otherwise.

dd if=sda5-pablokal_new.pbr of=/dev/sda bs=512 count=1 seek=413416773

3) Reboot the computer

4) Check that the file system is recognized in GParted

5) If all seems fine then I would advise booting into Windows and running "chkdsk /f /r" multiple times, until there are no more faults.

9

Re: [Solved]Error when resizing ntfs partition using gparted 0.8.0

Thanks, that did it!
Now I still have to figure out why the pbr I edited myself didn't work.
Btw I had to boot in Windows to get admission to sda5; it did an automatic chkdsk when booting Win7 up.

I do have some suggestions for the gparted live cd taht I will post somewhere else.

10

Re: [Solved]Error when resizing ntfs partition using gparted 0.8.0

'Glad to hear you are back up and running again.   smile