How to interpret this case of probable overlapping partitions (unallocated drive in Gparted)?
I may have played too much with different operating systems and now I'm in trouble.
I'll promise not to do it again, but first please help me put my machine back on track! :))
I had three Linux systems and two Windows on the same laptop! I wanted to get rid of some of them, but before that I decided to test if Windows XP would work on that computer (why? I prefer to have a Windows system at hand but in both Win 7 and 10 the laptop fan is too loud compared to what I want (and have in Linux) and therefore I just wanted to text XP...)
Windows 10 is at the beginning of the drive (sda1), then comes a NTFS larger depo drive without any OS (sda2), then there is an extended partition (sda3) containing the 3 Linux partitions and the Windows 7 partition (detail below).
What I did was: I removed the last Linux (sda8) and there I installed XP and all worked relatively well there - except for the fan, which made me think I should remove XP too etc.
After that, I booted in Live CD and wanted to get rid of some of the Windows partitions: looking at the partitions in Gparted all the drive looked unallocated.
I installed the boot-repair tool in the live environment to fix the grub, I used the recommended setting to remove and reinstall the grub. I decided to install it on sda5 (my preferred Linux system) and all looked fine.
After reboot all the operating systems were available in the boot list, except the last XP partition.
Also, in Gparted all the drive is still reported unallocated - although now all systems except XP are accessible and working.
Looking here on How-to Fix Overlapping Partitions I did in Terminal as follows:
cip@cip-HP:~ > sudo parted /dev/sda unit s print
[sudo] password for cip:
Error: Can't have overlapping partitions.
cip@cip-HP:~ > sudo fdisk -l -u /dev/sda
omitting empty partition (5)
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 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: 0x000d2515 Device Boot Start End Blocks Id System
/dev/sda1 * 2048 104859647 52428800 7 HPFS/NTFS/exFAT
/dev/sda2 104859648 613181439 254160896 7 HPFS/NTFS/exFAT
/dev/sda3 613185596 976766618 181790511+ 5 Extended
/dev/sda4 713537536 799438847 42950656 7 HPFS/NTFS/exFAT
/dev/sda5 613185598 713537535 50175969 83 Linux
/dev/sda6 799440896 883327614 41943359+ 83 Linux
/dev/sda7 883331072 976764927 46716928 7 HPFS/NTFS/exFATI don't know how to interpret this. I see no overlapping, only that sda5 comes before sda4 at the beginning of the extended partition.
I'll add a snapshot with more comments on the partitions:
What should I do?
UPDATE:
In Windows 7 I have deleted the XP and Windows 10 partitions using Disk Management. That has changed nothing. In Gparted the whole drive is still unallocated. I want to be able to access and use the ex-XP and Win-10 partitions.
22 Answers
Your problem is the partition 4: it is a primary partition contained inside an extended partition - and that is illegal.
By definition, in a msdos-type partition table, the primary partitions receive numbers from 1 to 4. The fact that the partition 4 is wholly contained inside the extended partition 3 is what is causing these problems.
In the GParted Wiki you can read:
3. Primary partitions must not exist within an Extended partition.
Again in the Gparted wiki but later on, you can read: under the heading How-to Fix Overlapping Partitions, you find:
Do any of the primary or extended partitions overlap?
In other words does one partition (numbers 1 to 4) have a start value lower than another partitition (numbers 1 to 4) but also an end value higher than the start of the other partition?
These clearly state that partitions 1-4 are by default primary. Hence your extended partition, 3, includes illegally a primary partition.
You can find further confirmation of this very rigid naming scheme in this Wikipedia article.
The strategy to solve this is very easy: rename partition 4 to 8, an allowed number, and then change the partition table to reflect the change. The GParted Wiki page referenced above tells you how to do that; it is sufficiently delicate that I do not feel it appropriate to summarize the page content here, you will have to study the process thoroughly lest parts of your disk may vanish into the netherworld.
Also, you will have to modify the files (like /etc/fstab) that referred to sda4 to reflect the change above, wherever partition 4 was used.
As indicated in the update to the question: While Gparted reported all the drive as unallocated in Linux, I have booted in Windows 7, and there all the drive and its partitions were visible in Disk Management. Using Disk Management,I have deleted the Windows XP partition (sda8) which became unallocated space.
I have tried to do the same with the Windows 10 partition (sda1) - but after that the partition was still visible in Disk Management. Unsure whether this was an error and whether Disk Management was the proper tool, I then installed MiniTool Partition Wizard Free Edition which I had successfully used in the past.
MiniTool Partition Wizard showed not only an unallocated space of 46 GB where the sda8 partition was, but a 85 GB unallocated space in the space of both sad7 and sda8 partitions. Deleting the XP partition (sda8) had also deleted the sda7 partition of my (luckily) secondary Linux system.
Then, using MiniTool Partition Wizard, I deleted also the Windows 10 partition (sda1) and created a new Linux ext4 partition out of the 85 GB unallocated space at the end of the drive. Trying to create a new NTFS partition with MiniTool Partition Wizard in the unallocated space at the beginning of the drive, I got a message saying "not enough slots".
I then booted in the one Linux system left, and there now Gparted was seeing all the drive. I extended the large NTFS partition to the left (moving data to the left) in Gparted to get one big NTFS at the beginning of the drive, without any OS, and keeping only Windows 7 and a Linux on this machine. I also kept the separate ext4 partition at the end of the drive.
In terminal I get:
cip@cip-HP:~ > sudo parted /dev/sda unit s print
[sudo] password for cip:
Model: ATA Hitachi HTS54505 (scsi)
Disk /dev/sda: 976773168s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags 1 2048s 613181439s 613179392s primary ntfs 2 613185596s 713537535s 100351940s extended lba 5 613185598s 713537535s 100351938s logical ext4 3 713537536s 799438847s 85901312s primary ntfs 4 799438848s 976766975s 177328128s primary ext4
cip@cip-HP:~ > sudo fdisk -l -u /dev/sda
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 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: 0x000d2515 Device Boot Start End Blocks Id System
/dev/sda1 2048 613181439 306589696 7 HPFS/NTFS/exFAT
/dev/sda2 613185596 713537535 50175970 f W95 Ext'd (LBA)
/dev/sda3 713537536 799438847 42950656 7 HPFS/NTFS/exFAT
/dev/sda4 799438848 976766975 88664064 83 Linux
/dev/sda5 613185598 713537535 50175969 83 LinuxNow all systems work, and I also don't seem to have the initial problem reported in the other answer: the extended partition (now sda2) doesn't seem to contain any primary partitions anymore. The Windows 7 partition (now sda3) which before had a different number and was a primary partition inside the extended partition, is now seen as a primary partition outside the extended one (which now contains only one logical partition: sda5).
2