1 (edited by gedakc 2010-01-13 18:57:22)

Topic: SOLVED - Mao: Current NTFS volume size is bigger than the device size!

Tried to resize NTFS (WinXP) partition (/dev/sda1) with GParted (SystemRescueCD 1.3.4).

This resulted to an unbootable WinXP isntallation. Luckily, the Ubuntu on the same PC still works !
Using that to provide the requested information:

------------
$ sudo fdisk -l -u
[sudo] password for mo:

Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders, total 234441648 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0xcccdcccd

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1              63   102398309    51199123+   7  HPFS/NTFS
/dev/sda2   *   225046080   234435599     4694760   12  Compaq diagnostics
Partition 2 does not end on cylinder boundary.
/dev/sda3       102398310   225038519    61320105    5  Extended
/dev/sda5       102398373   123363134    10482381   83  Linux
/dev/sda6       224010423   225038519      514048+  82  Linux swap / Solaris
/dev/sda7       123363198   224010359    50323581   83  Linux

Partition table entries are not in disk order
------------
$ sudo parted /dev/sda unit s print
Model: ATA WDC WD1200BEVE-0 (scsi)
Disk /dev/sda: 234441648s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start       End         Size        Type      File system  Flags
1      63s         102398309s  102398247s  primary   ntfs             
3      102398310s  225038519s  122640210s  extended                   
5      102398373s  123363134s  20964762s   logical   ext4             
7      123363198s  224010359s  100647162s  logical   ext4             
6      224010423s  225038519s  1028097s    logical   linux-swap       
2      225046080s  234435599s  9389520s    primary   fat32        boot

------------

2

Re: SOLVED - Mao: Current NTFS volume size is bigger than the device size!

So far we have not been able to recreate the resize problem using SysRescCD 1.3.4, so perhaps the problem you are experiencing is something different?

To confirm the problem, you can start up GParted and see if there is an exclamation point beside the sda1 partition.  If so then double-click the partition to show more information and the error message associated with the partition.

3

Re: SOLVED - Mao: Current NTFS volume size is bigger than the device size!

gedakc wrote:

So far we have not been able to recreate the resize problem using SysRescCD 1.3.4, so perhaps the problem you are experiencing is something different?

To confirm the problem, you can start up GParted and see if there is an exclamation point beside the sda1 partition.  If so then double-click the partition to show more information and the error message associated with the partition.

I don't mean to hijack the thread but I can assure you with 100% certainty that Sysrcd-1.3.4 (7fa0812c824d35a360bb2b6c2921fa7c  sysrcd.dat) is broken. I experienced this problem this morning after downloading the CD image and attempting to resize an NTFS partition using gparted after booting the CD.

Fortunately I was able to edit the NTFS partition table(?) (.pbr) using some of the examples that have been included in the forum... and that's brought my NTFS partition back to life.

Disk /dev/sdd: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders, total 234441648 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x64656469

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1   *        2048   133676864    66837408+   7  HPFS/NTFS

root@sysresccd /root % parted /dev/sdd unit s print
Model: Generic External (scsi)
Disk /dev/sdd: 234441648s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start  End         Size        Type     File system  Flags
1      2048s  133676864s  133674817s  primary  ntfs         boot

hexedit of the top of my pdr file (wrong value is 0df8f0f8, which is the old partition size...):

00000000   EB 52 90 4E  54 46 53 20  20 20 20 00  02 08 00 00  .R.NTFS    .....
00000010   00 00 00 00  00 F8 00 00  3F 00 F0 00  00 08 00 00  ........?.......
00000020   00 00 00 00  80 00 80 00  F8 F0 F8 0D  00 00 00 00  ................

what I changed it to (133674816 or 133674817 - 1)

00000000   EB 52 90 4E  54 46 53 20  20 20 20 00  02 08 00 00  .R.NTFS    .....
00000010   00 00 00 00  00 F8 00 00  3F 00 F0 00  00 08 00 00  ........?.......
00000020   00 00 00 00  80 00 80 00  40 B7 F7 07  00 00 00 00  ........@.......

There's definitely something wrong with the gparted/ntfsresize/kernel in the SysRescCD 1.3.4 that exactly mimics all of the problems that have been showing up in this forum.

4

Re: SOLVED - Mao: Current NTFS volume size is bigger than the device size!

mao and sionidral,

Thank you for reporting this problem as occurring with sysresccd-1.3.4.  I have updated the parent tracking post with this information.


mao,

Next we will need copies of the Master Boot Record and the NTFS Partition Boot Record.

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-mao.mbr bs=512 count=1

where sda-mao.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=sda1-mao.pbr bs=512 count=1 skip=63

where sda1-mao.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, and post the link to these files in this forum post.

5

Re: SOLVED - Mao: Current NTFS volume size is bigger than the device size!

gedakc wrote:

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

Hi.

Here's a link to a tar file containing the requested boot records:
http://koti.mbnet.fi/mjon/MaO-BootRecords.tar

6

Re: SOLVED - Mao: Current NTFS volume size is bigger than the device size!

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 203,045,464 sectors:
00000020   00 00 00 00  80 00 80 00  58 3A 1A 0C  00 00 00 00
To a new length of 102,398,246 sectors:
00000020   00 00 00 00  80 00 80 00  26 79 1A 06  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: sda1-mao_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=sda1-mao_new.pbr of=/dev/sda bs=512 count=1 seek=63

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.

7

Re: SOLVED - Mao: Current NTFS volume size is bigger than the device size!

gedakc,

Thank you for your help and really clear instructions !
With those instructions I was now able to boot into Windows as well.

Hopefully you'll find a fix for this problem soon, so we can safely use this excellent tool in future as well.

8

Re: SOLVED - Mao: Current NTFS volume size is bigger than the device size!

It is good to hear that you are up and operational again.  smile

I will edit the initial post to prefix "SOLVED" in front of the title.