So, I have Linux Mint installed on my computer and then attempted to install WindowsXP on another primary partition. After the installation finished, I found my data partition sda9 (which is a logical one) had been deleted. I think I didn't delete it by mistake so I guess it's caused by Windows XP installer. I tried to use TestDisk to analyze the disk and fix the partition table, and I am now able to access to my data partition from both Mint and Windows XP.The problem is, when I use parted to show partitions on my disk, it shows an error like this:Error: Can't have a partition outside the disk!However, fdisk -l shows all the partitions correctlyDisk /dev/sda: 500.1 GB, 500107862016 bytes255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x0006a436   Device Boot      Start         End      Blocks   Id  System/dev/sda1   *        2048    61442047    30720000   83  Linux/dev/sda2        61442048   106498047    22528000    7  HPFS/NTFS/exFAT/dev/sda3       106498048   204802047    49152000    7  HPFS/NTFS/exFAT/dev/sda4       204802101   976784129   385991014+   f  W95 Ext'd (LBA)/dev/sda5       204804096   214566895     4881400   82  Linux swap / Solaris/dev/sda6       225279495   286712054    30716280    7  HPFS/NTFS/exFAT/dev/sda7       286712118   327661739    20474811    1  FAT12/dev/sda8       360454144   417796095    28670976   83  Linux/dev/sda9       417798144   976773119   279487488    7  HPFS/NTFS/exFATDisk /dev/sdb: 16.0 GB, 16008609792 bytes255 heads, 63 sectors/track, 1946 cylinders, total 31266816 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x0004f355   Device Boot      Start         End      Blocks   Id  System/dev/sdb1   *        2048    31266815    15632384    c  W95 FAT32 (LBA)sda9 was the data partition that was somehow deleted, sda6 and 7 are 2 unknown partitions that TestDisk wrote to my partition table. Other than that, all the partitions are correct.How should I fix my partition table now?
Partition table is corrupted after using TestDisk
partition
Your sda4 partition is invalid. That output says your drive has 976773168 sectors, yet sda4 ends at 976784129. This is not possible.The solution is to recreate that partition with a correct size. However this is the tricky part. Since that is an extended partition, you have to delete every single partition after it. None of the partitions after it actually extend past the end of the disk, so you should be safe as long as you recreate them with the exact same start and end locations.Note, it would still be a good idea to back up your data. Especially since things aren't in a normal state right now.