1 (edited by OjM 2010-04-24 17:57:47)

Topic: [SOLVED] Got bitten by NTFS resize bug

Installed ubuntu 9.10, with settings that should have automatically installed it with Vista. Both systems works fine, but other NTFS partition, that is sda3, is messed up.

kyppo@kyppokone:~$ sudo fdisk -lu

Levy /dev/sda: 250.1 Gt, 250059350016 tavua
255 päätä, 63 sektoria/ura, 30401 sylinteriä, yhteensä 488397168 sektoria
Yksiköt = 1 * 512 = 512 -tavuiset sektorit
Levyn tunniste: 0xafe00929

    Laite Käynn     Alku          Loppu    Lohkot   Id  Järjestelmä
/dev/sda1            2048    18434047     9216000   27  Tuntematon
/dev/sda2   *    18434048   215900159    98733056    7  HPFS/NTFS
/dev/sda3       215900160   352675259    68387550    7  HPFS/NTFS
/dev/sda4       352691010   488392064    67850527+   5  Laajennettu
/dev/sda5       352691073   482769314    65039121   83  Linux
/dev/sda6       482769378   488392064     2811343+  82  Linux-sivutus / Solaris

kyppo@kyppokone:~$ sudo parted /dev/sda unit s print
Model: ATA WDC WD2500BEVS-2 (scsi)
Disk /dev/sda: 488397168s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start       End         Size        Type      File system     Flags
1      2048s       18434047s   18432000s   primary   ntfs
2      18434048s   215900159s  197466112s  primary   ntfs            boot
3      215900160s  352675259s  136775100s  primary   ntfs
4      352691010s  488392064s  135701055s  extended
5      352691073s  482769314s  130078242s  logical   ext3
6      482769378s  488392064s  5622687s    logical   linux-swap(v1)

And here is the ntfsresize output, which tells me volume size is too big.

kyppo@kyppokone:~$ sudo ntfsresize -if /dev/sda3
ntfsresize v2.0.0 (libntfs 10:0:0)
Device name        : /dev/sda3
NTFS volume version: 3.1
Cluster size       : 4096 bytes
Current volume size: 139517415936 bytes (139518 MB)
Current device size: 70028851200 bytes (70029 MB)
ERROR: Current NTFS volume size is bigger than the device size!
Corrupt partition table or incorrect device partitioning?

2

Re: [SOLVED] Got bitten by NTFS resize bug

Did you use the Ubuntu 9.10 Live CD for the installation and NTFS file system resizing?

To resolve this problem 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-ojm.mbr bs=512 count=1

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

where sda1-ojm.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: [SOLVED] Got bitten by NTFS resize bug

Yes, I resized NTFS with 9.10 live cd, with the first option, which was to keep Windows and resize NTFS to make space for Ubuntu, or something like that.

Here are the files.

http://www.mediafire.com/?midujmmmthz
http://www.mediafire.com/?tjdmd5a5ymw

4

Re: [SOLVED] Got bitten by NTFS resize bug

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 272,494,952 sectors:
00000020   00 00 00 00  80 00 80 00  68 F1 3D 10  00 00 00 00
To a new length of 136,775,099 sectors:
00000020   00 00 00 00  80 00 80 00  BB 05 27 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-ojm_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-ojm_new.pbr of=/dev/sda bs=512 count=1 seek=215900160

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.