first the story: I moved my Windows partition "to the left", then were unable to (dual) boot Windows, tried the repair option on the Win8 CD ... and now seem to have more than 4 primary partitions. gparted now shows the whole disk unallocated "Can't have overlapping partitions".
Here's what the partition table looks like (viewed from live CD):
ubuntu@ubuntu:~$ sudo parted /dev/sda unit s print
Error: Can't have overlapping partitions.
ubuntu@ubuntu:~$ sudo fdisk -l -u /dev/sda
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: 0x000524e5
Device Boot Start End Blocks Id System
/dev/sda1 2046 134217727 67107841 5 Extended
/dev/sda2 134217728 150798335 8290304 82 Linux swap / Solaris
/dev/sda3 * 150798336 151515135 358400 7 HPFS/NTFS/exFAT
/dev/sda4 * 237004800 237721599 358400 7 HPFS/NTFS/exFAT
/dev/sda5 237721600 488394751 125336576 7 HPFS/NTFS/exFAT
/dev/sda1 is where my ext4 Linux partition used to be. I am aware of the answers at GParted shows "unallocated" on my sda drive (parallel boot with Win XP) and also read a lot more. I understand that I can only have 4 primary partitions and /dev/sda5 should be within an extended partition - causing the "overlapping" warning.
What I do not know: How do I solve the problem? I'd prefer to keep my old linux partition - but even if I did not, I can't just reinstall Ubuntu, because the disk is in an invalid state. And I am lucky that windows works fine on /dev/sda5 and would prefer not to remove this partition.
What I also do not understand: What are the two mini-partitions 3 and 4 good for? I assume that windows had created them as boot partitions or something like that ... so, can I remove one of them? Windows mounts the second one as D: and shows files like Temp\disklayout.txt including information on the disk like it used to be before the "repairs":
Partition ### Typ Größe Offset
------------- ---------------- ------- -------
Partition 0 Erweitert 63 GB 1023 KB
Partition 4 Logisch 63 GB 1024 KB
Partition 1 Primär 8096 MB 64 GB
Partition 2 Primär 350 MB 113 GB
Partition 3 Primär 119 GB 113 GB
Thanks a lot for helpful directions!
Update 1
I tried to get rid of the superfluous partition using sfdisk and writing a modified table to the disk. And when the last partition showed up twice, I used fdisk to remove that one. The result looked good.
/dev/sda1 : start= 2046, size=134215682, Id= 5
/dev/sda2 : start=134217728, size= 16580608, Id=82
/dev/sda3 : start=237004800, size= 716800, Id= 7, bootable
/dev/sda4 : start=237721600, size=250673152, Id= 7
When I then did a try with fixparts, it's analysis is ... irritating:
MBR command (? for help): p
** NOTE: Partition numbers do NOT indicate final primary/logical status,
** unlike in most MBR partitioning tools!
** Extended partitions are not displayed, but will be generated as required.
Disk size is 488397168 sectors (232.9 GiB)
MBR disk identifier: 0x000524E5
MBR partitions:
Can Be Can Be
Number Boot Start Sector End Sector Status Logical Primary Code
2 134217728 150798335 logical Y Y 0x82
3 * 237004800 237721599 logical Y Y 0x07
4 237721600 488394751 primary Y 0x07
Although sfdisk displays the first partition, fixparts won't.
Update 2
Well, well. I wasn't so lucky with fixparts, but testdisk did the trick. Not alone, but the critical part. Here's what helped for me (I'm writing from the once-lost Ubuntu, jippi) - may be helpful for someone else.
A warning in advance: I never thought that messing around with parition tables was so much fun! But probably don't do that (without a full disk backup), if have have important data on the disk.
- The first part would probably been easier just using
fdisk /dev/sdato delete the superfluous partition.- Downloaded the partition table via
fsdisk -d /dev/sda > SomeUSBFile - Manually removed the superfluos partition from this file (and changed the numbers of the remaining partitions accordingly)
- Written the modified partition table via
fsdisk /dev/sda < SomeUSBFile - Deleted the last partition, that now was displayed two times via
fdisk
- Downloaded the partition table via
- The Linux partition was still missing, so I ran
testdiskfrom the Ubuntu live USB stick. It found that there actually is no extended partition, but a primary linux partition instead. But it did not see the Windows 10 partitition.- So I, again, wrote the partition table to a file
fsdisk -d /dev/sda > SomeUSBFile - let
testdiskwrite the new partition table (the one, it found after searching for partitions), - exported this partition table to another file,
- copied the line of the linux partition, and
- inserted this line into the original partition table's file to
- import this modified version via
fsdisk /dev/sda < SomeUSBFile.
- So I, again, wrote the partition table to a file
- Windows still run :)
- The ubuntu live-USB then allowed to mount the linux partition (which is strange, as I had enabled encryption during the linux installation...), and install a new grub MBR to /dev/sda (http://howtoubuntu.org/how-to-repair-restore-reinstall-grub-2-with-a-ubuntu-live-cd)
- Finally, the swap partition (the old one was now "unknown" in gparted) has to be recreated in gparted.
sudo sfdisk -d /dev/sdX >parts_ parts.txtorsudo sfdisk -d /dev/sda > parts_sda.txtThen see what testdisk and/or fixparts show. – oldfred Apr 04 '16 at 21:14sudo sfdisk -T. You need to change 5 to 83, then fixparts may see it. Start also then should be 2048. As extended needed 2 sectors before first partition inside it. You may be able to use testdisk also to recover partition. – oldfred Apr 08 '16 at 19:50sfdiskeffort to delete a "superfluous" partition actually deleted an important partition. When you ranfixparts, it showed the modified partition table without showing the extended partition. You'd have been better off at least trying withfixpartsbefore adjusting the partition table with other tools. I can't promise it would have worked, but it might have done so. – Rod Smith Apr 09 '16 at 14:16fixpartsfirst would probably been more sensible -- if I had the idea to change the assumes-extended partition to type 83 in time... – BurninLeo Apr 10 '16 at 11:39