I wimped out and used http://www.partition-recovery.com
to recover the NTFS data partition (I was under a time constraint).
But I would still like to know how to fix this using a free open source tool/methods. So I am still very much into this thread. The tool I used did not have any problem at all and so I assume its a simple problem to fix.
Perhaps imp info that should be mentioned: I am using easyBCD 2.0 beta:
(but it had not caused problems earlier)
I recreated the linux logical partitions over the old linux logical partitions.
So, before I did the reinstall, my HDD looked like
1=XP NTFS primary
2=Linux / ext4 logical
3=Linux /home ext4 logical
4=Win 7 NTFS logical
5=NTFS data logical
7=NTFS recovery partition
In the intermediate reinstall, I deleted 2& 3, so my HDD looked like
Then I created the ext4 partitions back in the old place.
So, the HDD looked like as before
Then I said write grub to /dev/sda8 (sda8 was where the old linux parition (2) was). Then the reinstall went fine.
But then after I added the linux entry in easy BCD, linux/gparted would not see ANY partitions over the entire HDD.
However, both XP and win 7 would boot fine (but would show 222333 & 555666 area as free space (seperated by the win 7 partition).
In the future, how can I fix the borked HDD ?
BTW, the free version of partition recovery showed the missing NTFS data partiton as First sector: 215640558 amd sectors = 75409040 & cluster size = 4096. Is this info useful ?
Finally another piece of info (I'm trying to think of everything). When I put in the linux entry in easyBCD, it seems to cause a minor hiccup, in that when I reboot into linux for the first time, it complains that inode access time is in the future and tells me to do fsck for both the ext4 partitions. Fsck runs fine and does one repair operation, and from then on everythign is fine.
So, 1) is easyBCD the culprit ? 2) perhaps writing grub to wrong device ? and 3) how to fix a similar borked HDD ?
Originally Posted by jschiwal
Post the results of "sudo /sbin/fdisk -l" and "sudo /sbin/fdisk -lu".
Did you recreate new partitions over the old ones or move them to the beginning of the drive?
If the part of the disk where your XP partition used to be isn't damaged, you can still mount it. I would then backup the files for insurance before attempting to repair your partition table.
# Assuming standard XP/Linux partition scheme:
sudo /sbin/losetup -fs /dev/sda1 -o $((63*512))
# will use the first available loop device and print which loop device was used.
# if your version of losetup doesn't print the device used run "sudo /sbin/losetup -a" to show you
# all of the loop devices.
# assuming loop0 was used:
sudo file -s /dev/loop0
# hopefully you will see something like this (my laptop has vista with a different offset)
# /dev/sda1: x86 boot sector, code offset 0x52, OEM-ID "NTFS ", sectors/cluster 8, reserved sectors 0, Media descriptor 0xf8, heads 255, hidden sectors 2048, dos < 4.0 BootSector (0x80)
# this will return the size of the filesystem, allowing you to set end of that partition in the partition table by adding it to 63 blocks.
sudo df /dev/loop0
sudo mount -t ntfs /dev/loop0 /mnt/
# at this point if successful, you can backup the files on your XP partition. Then use the values obtained to fix your partition table for the first partition on the disk.