1 (edited by mandje 2009-11-24 10:32:15)

Topic: SOLVED ntfs shrinking resulted in size mismatch/windows 7 corruption

hi all,

i read the postings which are on the same problem in a way and hope to have mine resolved as well.

description;
i wanted to shrink the windows 7 partition on sdb (all of the 160G disk) back to 120G.
(windows 7 calls sdb C:, and the part of sda that has ntfs partition D:)
(the shrinking was initiated because i wanted to install fedora 11 in raid0 layout on the last 40G of sda + sdb.)

a week ago i ran fedora 11 live cd. i installed gparted via software installer. so as the live cd, gparted was only installed in memory.
i than shrank sdb1 back to 120G, log did not report any error. this log wasn't saved.

after that windows 7 had a bsod while booting. error:  unmountable_boot_volume. win7 rescue was not able to repair.
gparted reported something was wrong with sdb1 and also i saw a report on the ntfs size mismatch.

what details i need to produce to fix sdb1?

2

Re: SOLVED ntfs shrinking resulted in size mismatch/windows 7 corruption

Would you be able to provide the output from the following two commands?

fdisk -l -u

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

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

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

3 (edited by mandje 2009-11-23 19:52:05)

Re: SOLVED ntfs shrinking resulted in size mismatch/windows 7 corruption

hello gedakc. thank you for your time.

yes i'm able.
http://paste.ubuntu.com/326272/

sdc is just the external usb disk connected atm.

regards

4

Re: SOLVED ntfs shrinking resulted in size mismatch/windows 7 corruption

The next steps are to get 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/sdb of=sdb-mandje.mbr bs=512 count=1

where sdb-mandje.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/sdb of=sdb1-mandje.pbr bs=512 count=1 skip=2048

where sdb1-mandje.pbr is the name of the file that will need to be uploaded.


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

5

Re: SOLVED ntfs shrinking resulted in size mismatch/windows 7 corruption

ok. next 2 steps done.

http://www.mediafire.com/file/tztttmtkz … mandje.mbr
http://www.mediafire.com/file/m3j2mzjny … mandje.pbr

6

Re: SOLVED ntfs shrinking resulted in size mismatch/windows 7 corruption

In this situation, the cause of this problem can clearly be seen.
234,434,497 sectors - length of partition
312,575,992 sectors - size of NTFS volume

I think it is safest if we increase the partition size to encompass the entire NTFS volume.

The change I have made to the file is from a length of 234,434,497 sectors:
000001C0   21 00 07 FE  FF FF 00 08  00 00 C1 2F  F9 0D 00 00
To a new length of 312,575,993 sectors:
000001C0   21 00 07 FE  FF FF 00 08  00 00 F9 87  A1 12 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 MBR: sdb-mandje_new.mbr

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

dd if=sdb-mandje_new.mbr of=/dev/sdb bs=512 count=1

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.


NOTE:  For advice on which version of GParted Live to use, see post:
WARNING! Problem Resizing File Systems with GParted

7

Re: SOLVED ntfs shrinking resulted in size mismatch/windows 7 corruption

hi gedakc,

yesss! recovered the partition and windows 7 runs again. phew!
i will try to get the courage again for shrinking once more but will use or windows 7 own feature, or the gparted version you directed to.
thank you very much for your outstanding help.

regards
Gerry

8

Re: SOLVED ntfs shrinking resulted in size mismatch/windows 7 corruption

I am glad to hear that the problem is solved.  Thanks also for editing the title of the initial post and prefixing the title with "SOLVED".  smile