1 (edited by bhieda 2009-12-16 10:33:10)

Topic: [SOLVE] Problem Resizing NTFS using live 5.03 w/fdisk and parted

Hello,

I've tried using gparted to resize a windows 7 x64 for install.  Resizing appeared to complete successfully with gparted, but I am now unable to boot up in windows 7.  Here is the requested outputs:

/dev/sda1 contains the install of windows 7

--------

fdisk:

Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397168 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0xc8d848da

   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          206848   365510879   182652016    7  HPFS/NTFS

Disk /dev/sdd: 8054 MB, 8054636032 bytes
255 heads, 63 sectors/track, 979 cylinders, total 15731711 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1   *        2048    15730687     7864320    b  W95 FAT32
Partition 1 has different physical/logical endings:
     phys=(978, 254, 63) logical=(979, 48, 29)

Disk /dev/sdc: 262 MB, 262144000 bytes
255 heads, 63 sectors/track, 31 cylinders, total 512000 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x003f81f2

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *          63      511999      255968+   c  W95 FAT32 (LBA)
Partition 1 has different physical/logical endings:
     phys=(30, 254, 63) logical=(31, 221, 62)

---------

parted output:

Model: ATA WDC WD2500BEVT-7 (scsi)
Disk /dev/sda: 488397168s
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      206848s  365510879s  365304032s  primary  ntfs

------

Thank You for you help.

Bryan

2

Re: [SOLVE] Problem Resizing NTFS using live 5.03 w/fdisk and parted

Next will 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-bheida.mbr bs=512 count=1

where sda-bheida.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-bheida.pbr bs=512 count=1 skip=2048

where sda1-bheida.pbr is the name of the file that will need to be uploaded.


If you also resized sda2 then the following file would be useful too.

dd if=/dev/sda of=sda2-bheida.pbr bs=512 count=1 skip=206848

where sda2-bheida.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.

3

Re: [SOLVE] Problem Resizing NTFS using live 5.03 w/fdisk and parted

Here is a link to the requested files: http://www.mediafire.com/?sharekey=d22a … 785cc0f59e

Thanks,

Bryan

4

Re: [SOLVE] Problem Resizing NTFS using live 5.03 w/fdisk and parted

The first partition looks good.  Only the second partition appears to be experiencing this resizing problem.

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 488,187,896 sectors:
00000020   00 00 00 00  80 00 80 00  F8 27 19 1D  00 00 00 00
To a new length of 365,304,031 sectors:
00000020   00 00 00 00  80 00 80 00  DF 18 C6 15  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: sda2-bheida_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=sda2-bheida_new.pbr of=/dev/sda bs=512 count=1 seek=206848

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.

5

Re: [SOLVE] Problem Resizing NTFS using live 5.03 w/fdisk and parted

It worked! big_smile Thank you for your help!

6

Re: [SOLVE] Problem Resizing NTFS using live 5.03 w/fdisk and parted

I am happy to hear that your problem is fixed.  smile

Thank you also for editing the initial post an prefixing it with SOLVED.

7

Re: [SOLVE] Problem Resizing NTFS using live 5.03 w/fdisk and parted

gedakc - would you have time to explain how you came up with 488,187,896 sectors?  Manually editing boot records sounds like a neat hack that maybe we should learn how to do rather than bug you smile

8

Re: [SOLVE] Problem Resizing NTFS using live 5.03 w/fdisk and parted

To learn more about partition tables and file system structure, read some of the links at the bottom of the GParted Documentation page.

You can discover the answer to your question in the MBR and NTFS Boot Record Secrets links.  smile