1

Topic: NTFS partition problem after Fedora partition shrink

I tried to shrink primary NTFS partition (where I have Win7 installed) in the Fedora installer. Now I cannot boot windows and I get "Failed to read last sector" error in GParted drive information.

Could you please advise me how to solve this?

MBR dd if=/dev/sda of=sda-pablokal.mbr bs=512 count=1: http://www.mediafire.com/file/f59z67lwf … blokal.mbr
PBR dd if=/dev/sda of=sda5-pablokal.pbr bs=512 count=1 skip=2048: http://www.mediafire.com/file/b4lxlisbq … blokal.pbr

fdisk -f -u

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
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x80d2f3ee

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048   143362047    71680000    7  HPFS/NTFS/exFAT
/dev/sda2       174289185   488392064   157051440    7  HPFS/NTFS/exFAT

Disk /dev/sdb: 2047 MB, 2047678976 bytes
64 heads, 63 sectors/track, 991 cylinders, total 3999373 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: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *         245     3995711     1997733+   6  FAT16

Disk /dev/mapper/live-rw: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders, total 8388608 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: 0x00000000

Disk /dev/mapper/live-rw doesn't contain a valid partition table

Disk /dev/mapper/live-osimg-min: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders, total 8388608 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: 0x00000000

parted /dev/sda unit s print

Model: ATA Hitachi HTS72322 (scsi)
Disk /dev/sda: 488397168s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start       End         Size        Type     File system  Flags
 1      2048s       143362047s  143360000s  primary  ntfs         boot
 2      174289185s  488392064s  314102880s  primary  ntfs

Thank you,
Roko

2

Re: NTFS partition problem after Fedora partition shrink

Out of curiousity, which version of Fedora were you trying to install?


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 174,286,847 sectors:
00000020   00 00 00 00  80 00 80 00  FF 67 63 0A  00 00 00 00
To a new length of 143,359,999 sectors:
00000020   00 00 00 00  80 00 80 00  FF 7F 8B 08  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-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=sda1-_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.

3 (edited by Roko 2011-11-03 13:59:14)

Re: NTFS partition problem after Fedora partition shrink

gedakc wrote:

Out of curiousity, which version of Fedora were you trying to install?
Since you were trying to shrink the partition, we will decrease the NTFS volume size to fit within the partition.
...cut

the newest one (Fedora 15)..

This didn't solve the problem. Now I get "Failed to mount... NTFS is inconsistent..." in Gparted.
It's intresting that Gparted reports original partition size (before shrink attempt - 83.11 GiB), while my data recovery software reports new size (after shrink attempt - 76,60 GiB)..
BTW, before applying the new PBR, i tried TestDisk fix partition table function.

chkdsk  /f /r reports following error: "Corrupt master file table. Windows will attempt to recover master file table from disk. Windows cannot recover master file table."
Windows cannot boot with error: "A disc error occured".

To doublecheck, i will provide current information again. Thank you a lot..

MBR dd if=/dev/sda of=sda-pablokal.mbr bs=512 count=1: http://www.mediafire.com/?dm83qflfr5eq31k
PBR dd if=/dev/sda of=sda5-pablokal.pbr bs=512 count=1 skip=63: http://www.mediafire.com/?i6kl2ymouf4d1zn

fidsk -l -u

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
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x80d2f3ee

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63   174289184    87144561    7  HPFS/NTFS/exFAT
/dev/sda2       174289185   488392064   157051440    7  HPFS/NTFS/exFAT

Disk /dev/sdb: 2047 MB, 2047678976 bytes
64 heads, 63 sectors/track, 991 cylinders, total 3999373 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: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *         245     3995711     1997733+   6  FAT16

Disk /dev/mapper/live-rw: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders, total 8388608 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: 0x00000000

Disk /dev/mapper/live-rw doesn't contain a valid partition table

Disk /dev/mapper/live-osimg-min: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders, total 8388608 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: 0x00000000

Disk /dev/mapper/live-osimg-min doesn't contain a valid partition table

parted /dev/sda unit s print

Model: ATA Hitachi HTS72322 (scsi)
Disk /dev/sda: 488397168s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start       End         Size        Type     File system  Flags
 1      63s         174289184s  174289122s  primary  ntfs         boot
 2      174289185s  488392064s  314102880s  primary  ntfs

4

Re: NTFS partition problem after Fedora partition shrink

Let's pause for a minute and define the problem.

In post #1 the PBR command said sda5, but indicated a sector offset of 2048.
By the way the partition table does not have an sda5 device.

Then in post #3 the PBR command again said sda5, but indicated a sector offset of 63.

Which partition is experiencing the problem?
Is it sda1 or sda2?

5

Re: NTFS partition problem after Fedora partition shrink

gedakc wrote:

In post #1 the PBR command said sda5, but indicated a sector offset of 2048.
By the way the partition table does not have an sda5 device.

Then in post #3 the PBR command again said sda5, but indicated a sector offset of 63.

I've copy pasted PBR command from the forum.. So the filename doesn't make sense, there is no sda5. The problem is with the sda1.

gedakc wrote:

Which partition is experiencing the problem?
Is it sda1 or sda2?

sda1.

6

Re: NTFS partition problem after Fedora partition shrink

174,289,122 sectors - size of sda1 partition from MBR file
172,289,121 sectors - size of NTFS file system on sda1 from PBR file

These values look correct already.

You might try restoring the original sector that was overwritten by the steps in post #2.
Then try "chkdsk /f /r" again.  Hopefully that will work.