1 (edited by glamplitude 2011-01-06 17:06:04)

Topic: [SOLVED] help, please? (another ntfsresize corruption...)

Dear gparted team

I read through the tutorial at http://gparted-forum.surf4.info/viewtopic.php?id=13937 and I think I understand it all, but my case doesn't involve the first partition, and I can not tell for sure which parts of the tut to change for sda5. I even tried looking in my hex dump for the magic with the partition IDs I have (converted to hex and inverted) but no luck. So I'm asking in the main forum for some help.

I totally love gparted and I use it all the time. This is the first problem I've ever had with it (and it would have to be on someone else's disk, wouldn't it! smile *sigh*) However, after seeing the amazing support from this forum, I am confident that the drive will soon be un-boned. I think I like gparted even more after reading this forum - you guys rock!

The problem: I did a succesful ntfsresize on a drive which had only a primary C: ntfs paritition and an extended partition, containing a big D: ntfs partition. I created two more primaries: a linux partition and a swap partition. I then succesfully installed linux, grub etc. However, I underestimated the space for linux and needed to steal a little more from the D: partition, so I tried once more to use the ubuntu 10.0.4 live CD and gparted, resulting in the current state of bonedness.

gparted managed to resize the extended partition, but bombed on resizing the D: partition inside it, leaving me with a reduced extended partition containing something which is too big for it.

If I can return to the previous state (small C:, big extended with D: inside, small linux, tiny swap), I'll be very happy. (In fact, if I can get there, I'll back the whole D: up and then replace it with a primary partition - I hate extended.)

So, if anyone out there is reading this who happens to understand and wants to help, you'll be giving this sad man a very happy new year indeed!

All the best, here's hoping! Also, thanks for all that you do, from a very grateful user!

Cheers!

Gareth

OK, going by what was requested of some of the others who've written in, I did the following:

# fdisk -l -u
# parted /dev/sda unit s print
# dd if=/dev/sda of=sda-glamplitude.mbr bs=512 count=1
# dd if=/dev/sda of=sda5-glamplitude.mbr bs=512 count=1 skip=31953348
# dd if=/dev/sda of=sda-glamplitude-skip-63.mbr bs=512 count=1 skip=63

(I did the extra dd for sda5 and also for sda, skipping the first 63 just in case that was applicable to my case)

I've put the boot record files up at http://marimbanation.com/gparted and the results from the queries are as follows:

root@ubuntu:~# fdisk -l -u

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

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63    31953284    15976611    7  HPFS/NTFS
/dev/sda2        31953346   618968384   293507519+   f  W95 Ext'd (LBA)
/dev/sda3       618968385   624880304     2955960   83  Linux
/dev/sda4       624880305   625137344      128520   82  Linux swap / Solaris
/dev/sda5        31953348   612960074   290503363+   7  HPFS/NTFS

root@ubuntu:~# parted /dev/sda unit s print
Model: ATA ST3320620AS (scsi)
Disk /dev/sda: 625142448s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start       End         Size        Type      File system     Flags
1      63s         31953284s   31953222s   primary   ntfs            boot
2      31953346s   618968384s  587015039s  extended                  lba
5      31953348s   612960074s  581006727s  logical   ntfs
3      618968385s  624880304s  5911920s    primary   ext4
4      624880305s  625137344s  257040s     primary   linux-swap(v1)

root@ubuntu:~# dd if=/dev/sda of=sda-glamplitude.mbr bs=512 count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 3.52e-05 s, 14.5 MB/s

2

Re: [SOLVED] help, please? (another ntfsresize corruption...)

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 586,870,440 sectors:
00000020   00 00 00 00  80 00 80 00  A8 EE FA 22  00 00 00 00
To a new length of 581,006,725 sectors:
00000020   00 00 00 00  80 00 80 00  85 75 A1 22  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: sda5-glamptitude_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=sda5-glamptitude_new.pbr of=/dev/sda bs=512 count=1 seek=31953348

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

Re: [SOLVED] help, please? (another ntfsresize corruption...)

Dear gedakc

You saved my bacon, man! (it was another guy's computer...)

If you ever are in South Africa, contact me - I owe you a big beer!

Cheers, thanks!

Gareth

4

Re: [SOLVED] help, please? (another ntfsresize corruption...)

I am happy to hear that you were able to solve the problem.  smile

Thanks also for editing the initial post to prefix SOLVED in front of the title.  This can help other people in the same situation who are searching for answers.