Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I was going to install a completely fresh Linux distribution (Mageia) and I saw it as an opportunity to reorganize my partitions. I wanted all my non-Linux (Windows, restore, etc) partitions at the beginning and my Linux ones at the end so I can more easily create new Linux partitions if I want to test some more distributions.

I used GParted to delete the existing Linux partitions (I backed up the data wanted to preserve) and moved the remaining ones to the front. I would later create the Linux partitions in the Mageia installer.

It took some time but in end GParted finished without problems. Mageia was installed without a hitch too.

When booting into Mageia I had some (unrelated?) issue with the ATI Radeon video card (still unresolved) that leaves me with just the console and when rebooting I saw Error: Can't have overlapping partitions zipping by.

No problem, I thought, I'll just boot GParted again and fix it. Alas, GParted shows the whole disk as unallocated. OK, back to Linux. Starting parted from command line gives me

[root@localhost ~]# parted
GNU Parted 2.3
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Error: Can't have overlapping partitions.

fdisk should give me more info and it did:

[root@localhost ~]# fdisk -l -u /dev/sda

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 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: 0x2bd2c32a

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      206847      102400    7  HPFS/NTFS
/dev/sda2          208845  1953520064   976655610    5  Extended
/dev/sda3       950740992  1013655551    31457280    7  HPFS/NTFS
/dev/sda4      1013655552  1015754751     1049600   12  Compaq diagnostics
/dev/sda5          208896   409808895   204800000    7  HPFS/NTFS
/dev/sda6       409810944   950740991   270465024    7  HPFS/NTFS
/dev/sda7      1015757883  1034184374     9213246   82  Linux swap / Solaris
/dev/sda8      1034184438  1953520064   459667813+  83  Linux

If I sort by partition start it seems that /dev/sda5 and /dev/sda6 should be called /dev/sda3 and /dev/sda4 and vice versa.

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      206847      102400    7  HPFS/NTFS
/dev/sda2          208845  1953520064   976655610    5  Extended
/dev/sda5          208896   409808895   204800000    7  HPFS/NTFS
/dev/sda6       409810944   950740991   270465024    7  HPFS/NTFS
/dev/sda3       950740992  1013655551    31457280    7  HPFS/NTFS
/dev/sda4      1013655552  1015754751     1049600   12  Compaq diagnostics
/dev/sda7      1015757883  1034184374     9213246   82  Linux swap / Solaris
/dev/sda8      1034184438  1953520064   459667813+  83  Linux

From googling I found that testdisk can fix this.

  1. How do I use testdisk? The interface is quite confusing.
  2. Can I run it from Linux/Windows or should I boot a live version?

Thanks in advance,

Nick


I followed the instructions in the answer below but it doesn't work.

These partitions I have to re-create:

/dev/sda3       950740992  1013655551    31457280    7  HPFS/NTFS
/dev/sda4      1013655552  1015754751     1049600   12  Compaq diagnostics

This is what happens:

[root@localhost ~]# fdisk /dev/sda

Command (m for help): d
Partition number (1-8): 3

Command (m for help): d
Partition number (1-8): 4

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First sector (950743040-1953520064, default 950743040): 950740992
Value out of range.
First sector (950743040-1953520064, default 950743040):

The 1st partition needs to start at 950740992 but the new one may only start at 950743040.

How do I proceed?

share|improve this question

migrated from serverfault.com Feb 4 '12 at 13:09

This question came from our site for professional system and network administrators.

    
It seems possible to migrate a question. How do I do that? –  Koohoolinn Jan 29 '12 at 11:15
    
You can either flag it for moderator attention and ask for migration or post to the "Vote to close" chat channel - a migration needs five migration votes from higher-reputation users. –  syneticon-dj Jan 29 '12 at 17:39

1 Answer 1

The overlapping partition problem arises partly due to the oddities of PC partitioning.

The partition table has space for exactly 4 "primary partition" entries. If you need to have more than 4 partitions, there is a mechanism called "extended" partitions - it actually creates a large partition (in your case partition #2) which in turn has an own sub-partition table, allowing for additional entries called "logical" partitions.

What you have done is creating an extended partition spanning from sector 208845 to 1953520064, but also additional primary partitions 3 and 4 overlapping the disk space reserved for the "extended" partition.

The most easy way to resolve matters would be as follows:

  • delete partitions 3 and 4 using Linux fdisk
  • re-create them (again using fdisk) as logical partitions within the extended partition using the same sector start/end values as before

If you would like the logical partition order to reflect their "physical" location on the disk, fdisk can help as well. Just press "x" to activate extended functionality and use the f ix partition order function. You might need to adjust your fstabs for Linux systems after that - Windows has GUID-based partition identification and should not care about the order.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.