1 (edited by gedakc 2010-03-10 21:38:24)

Topic: SOLVED - NTFS resize problem

I think i did it again.

I resized the NTFS partition during Fedora installation and now i can't boot to my Windows nor i can get access to my files. I saw on foruns people managed to correct the problem with your help. Please, what can i do?

From where i start?

Heres is my fdisk -l -u output

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x95e5f77c

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048   393431039   196714496    7  HPFS/NTFS
/dev/sda2       603146240   624723967    10788864    7  HPFS/NTFS
/dev/sda3       624723968   625135615      205824    7  HPFS/NTFS
/dev/sda4       393431850   603144359   104856255    5  Extended
/dev/sda5   *   393431913   393841512      204800   83  Linux
/dev/sda6       393841514   603143016   104650751+  8e  Linux LVM

Partition table entries are not in disk order

And here is my parted /dev/sda unit s print output

Model: ATA SAMSUNG HM320II (scsi)
Disk /dev/sda: 625142448s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start       End         Size        Type      File system  Flags
 1      2048s       393431039s  393428992s  primary   ntfs
 4      393431850s  603144359s  209712510s  extended
 5      393431913s  393841512s  409600s     logical   ext4         boot
 6      393841514s  603143016s  209301503s  logical                lvm
 2      603146240s  624723967s  21577728s   primary   ntfs
 3      624723968s  625135615s  411648s     primary   ntfs

Thank you!

2

Re: SOLVED - NTFS resize problem

Which partition did you shrink and are experiencing the problem with (e.g., sda1, sda2, or sda3)?

3

Re: SOLVED - NTFS resize problem

gedakc wrote:

Which partition did you shrink and are experiencing the problem with (e.g., sda1, sda2, or sda3)?

Well

i shrank the sda1 into sda1.

sda2 and sda3 are rescue partitions that i can't use anymore anyway.

I was hoping to be possible to merge sda1 and the extended partition back into one single partition and to grow ntfs filesystem just to get some private files since last backup, not too much but would avoid some rework.

What you say?

Thank you in advance.

4

Re: SOLVED - NTFS resize problem

edneymatias wrote:

i shrank the sda1 into sda1.

I mean, i shrank the old sda1 into the new sda1 and the extend partition at sda4 where i put sda5 and a LVM group at sda6.

Sorry.

5

Re: SOLVED - NTFS resize problem

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

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

where sda1-edneymatias.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.

6

Re: SOLVED - NTFS resize problem

gedakc wrote:

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

Here is the link to a folder with the files needed.

http://www.mediafire.com/?sharekey=a344 … c8b368bfbe

Thank you.

7

Re: SOLVED - NTFS resize problem

To avoid this problem in the future, be sure to use GParted 0.5.1+ or Parted 2.2+.

Now onto the solution for the 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 603,144,191 sectors:
00000020   00 00 00 00  80 00 80 00  FF 3F F3 23  00 00 00 00
To a new length of 393,428,991 sectors:
00000020   00 00 00 00  80 00 80 00  FF 3F 73 17  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-edney_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-edney_new.pbr of=/dev/sda bs=512 count=1 seek=2048

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.

8

Re: SOLVED - NTFS resize problem

gedakc wrote:

To avoid this problem in the future, be sure to use GParted 0.5.1+ or Parted 2.2+.
Now onto the solution for the problem..

Hi!

I can access files on filesystem! Thank you a lot! You were really fast on answering! You save me a lot of work time.

I didn't know that the tool used by the distro installer wouldn't shrink the filesystem even though it offered to shrink the partition.

I was trying to help a friend and screwed it all. You helped me a lot. Thank you.

Cheers.

9

Re: SOLVED - NTFS resize problem

'Glad to hear that the problem is now solved.  smile

I have taken the liberty of editing the initial post to prefix the title with SOLVED.