LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 06-11-2011, 12:41 PM   #1
grant or not
LQ Newbie
 
Registered: Nov 2004
Posts: 13

Rep: Reputation: 0
Overlapping partitions weirdness


Hi all,

I have 2 drives, sda and sdb, and I wanted to install ubuntu. sdb1 had a bootable copy of XP64 on it, and sdb2 had another copy of XP on it. Forgetting that the windows bootloader was on sdb1 (and not wanting to use xp64), I tried to install ubuntu over that but could not recover windows even after fixmbr and fixboot, so I reinstalled windows on sdb1 just to get the bootloader back. OK, then I installed ubuntu on sda after shrinking it (with grub on the MBR of sdb1), and the dual boot works fine. But now I want to shrink sdb1 and add that space to sdb2.

All drives are accessible in both OS's, but for some reason GParted shows sdb as unallocated, with the message "can't have overlapping partitions." XP's disk management shows the correct partitions, with an additional "unallocated space" that is equal to the sum of sdb5 and sdb6.

fdisk -lu outputs:

Disk /dev/sdb: 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: 0xba45ba45

Device Boot Start End Blocks Id System
/dev/sdb1 * 63 70300439 35150188+ 7 HPFS/NTFS
/dev/sdb2 70313982 1953503999 941595009 f W95 Ext'd (LBA)
/dev/sdb3 102398373 204796619 51199123+ 7 HPFS/NTFS
/dev/sdb5 204796683 1228795784 511999551 7 HPFS/NTFS
/dev/sdb6 1228795848 1953503999 362354076 7 HPFS/NTFS


For some reason, sdb2 is now an extended partition that contains the logical drives sdb3 (SYSTEM/XP32),sdb5(Data), and sdb6(Data2). Not really sure how that happened but I'm sure I gave it the go-ahead

When I go to analyze the disk in testdisk, I get:

Disk /dev/sdb - 1000 GB / 931 GiB - CHS 121601 255 63
Current partition structure:
Partition Start End Size in sectors

1 * HPFS - NTFS 0 1 1 4375 254 63 70300377
2 E extended LBA 4376 214 61 121599 254 63 1883190018
3 P HPFS - NTFS 6374 1 1 12747 254 63 102398247 [SYSTEM]
Space conflict between the following two partitions
2 E extended LBA 4376 214 61 121599 254 63 1883190018
3 P HPFS - NTFS 6374 1 1 12747 254 63 102398247 [SYSTEM]
X extended 12748 0 1 76488 254 63 1023999165
5 L HPFS - NTFS 12748 1 1 76488 254 63 1023999102 [Data]
X extended 76489 0 1 121599 254 63 724708215
6 L HPFS - NTFS 76489 1 1 121599 254 63 724708152 [Data2]

If I do a deep scan on them, the result is

Disk /dev/sdb - 1000 GB / 931 GiB - CHS 121601 255 63
Partition Start End Size in sectors
D HPFS - NTFS 0 1 1 4375 254 63 70300377
D HPFS - NTFS 0 1 1 6373 254 63 102398247
L HPFS - NTFS 6374 1 1 12747 254 63 102398247 [SYSTEM]
L HPFS - NTFS 12748 1 1 76488 254 63 1023999102 [Data]
L HPFS - NTFS 76489 1 1 121599 254 63 724708152 [Data2]


I don't remember ever seeing a primary partition on an extended partition... is this even kosher? Seems like there's a space conflict between the extended partition and the three logical drives, but why? So the what's with the duplicates here, and how can I get rid of them??

Thanks!
grant

Last edited by grant or not; 06-11-2011 at 12:41 PM. Reason: error
 
Old 06-11-2011, 03:17 PM   #2
alfredo10
Member
 
Registered: Sep 2010
Location: Algarve
Distribution: Linux Multiboot
Posts: 277

Rep: Reputation: 14
Hi!
Which version of GParted did you use? The latest one is 0.8.1 - as far as I know only available as GParted live; PartedMagic contains GParted 0.8 and most Linux distributions 0.7 or even earlier. I made the best experiences with GP 0.8.1.
You could post as root:
Code:
parted -l print
it will show the order of the partitions.
Normally sdb3 cannot be a logical partition - numbering always begins with 5 (first logical p.), independent of the number of primary partitions.
BTW: To better read your outputs, could you please copy and past - using # (code tags)?
alfredo
 
Old 06-11-2011, 04:10 PM   #3
jefro
Guru
 
Registered: Mar 2008
Posts: 12,093

Rep: Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521
Might see if ranish can fix it. It has been a long time since I have seen that. It ends up being a stinker to fix in some cases. The normal answer used to be delete it all and start over.
 
Old 06-11-2011, 07:50 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,504

Rep: Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079
Quote:
Originally Posted by grant or not View Post
I don't remember ever seeing a primary partition on an extended partition... is this even kosher? Seems like there's a space conflict between the extended partition and the three logical drives, but why? So the what's with the duplicates here, and how can I get rid of them??
No, it ain't kosher. As fdisk is trying to tell you. But, as evidenced by the fact that M$oft doesn't care, the data is o.k.
The partition table is just a table. If it were me I'd just do the maths and delete the offending partition (the extended), and allocate it properly.
Given the (recent) plethora of these sort of issues, I'd be inclined to blame Ubuntu ...
 
Old 06-11-2011, 09:14 PM   #5
grant or not
LQ Newbie
 
Registered: Nov 2004
Posts: 13

Original Poster
Rep: Reputation: 0
Quote:
If it were me I'd just do the maths and delete the offending partition (the extended), and allocate it properly.
If you could expand here, that'd be great. I wouldn't know where to start removing an extended partition, but I'd love to find out. Even though my data is backed up, I'd love an option that doesn't involve formatting this drive. Especially because I'm unfamiliar with imaging an OS partition, etc.

Quote:
Given the (recent) plethora of these sort of issues, I'd be inclined to blame Ubuntu ...
Yeah, it all started when I was going through the Ubuntu install expecting to see more options for partitioning, and then it just started doing what it wanted....

Also, I tried the latest GParted, with the same results (it shows that the entire drive is unallocated).

Concerning the drive in question

Code:
> sudo parted -l print 
Error: Can't have overlapping partitions.
 
Old 06-13-2011, 06:22 PM   #6
grant or not
LQ Newbie
 
Registered: Nov 2004
Posts: 13

Original Poster
Rep: Reputation: 0
Could you please help? I'm way 2 stupid to do it.
 
Old 06-14-2011, 07:10 AM   #7
alfredo10
Member
 
Registered: Sep 2010
Location: Algarve
Distribution: Linux Multiboot
Posts: 277

Rep: Reputation: 14
Hi!
Sorry that I don't have further ideas.
I'm using GParted live and PartedMagic live /GParted and other tools since a couple of years without a problem.
Maybe one of the tools in PartedMagic would help
http://partedmagic.com/doku.php?id=start
PartedMagic is more than an operating system.
Maybe "fdisk" is an option, but you need experience with the Terminal/ Konsole, see
Code:
man fdisk
alfredo
 
Old 06-14-2011, 08:15 AM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,504

Rep: Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079Reputation: 1079
Quote:
Originally Posted by me View Post
If it were me I'd just do the maths and delete the offending partition (the extended), and allocate it properly.
Hmmm - not as easy as it was it seems. I had a play with a spare disk, and was unable to re-allocate the extended to cover the primary /dev/sdb3 like that with fdisk. Wouldn't allow it - I'm sure it used to ...

Soooo .... see if fdisk will open the disk "fdisk /dev/sdb" and if so, from there use the "d" sub-command to delete partition 2. Then "w" to write the new partition table, and "q" to quit.
Then use testdisk (you may have to install it) to recover the logicals - testdisk will handle the extended automagically for you. I tested that and it all worked fine.

Don't forget you'll need to use sudo with Ubuntu.

Last edited by syg00; 06-14-2011 at 08:16 AM. Reason: sudo comment
 
Old 06-14-2011, 01:30 PM   #9
grant or not
LQ Newbie
 
Registered: Nov 2004
Posts: 13

Original Poster
Rep: Reputation: 0
Great, thanks, I'll give that a try in the next few days. Before I start though, I wonder if it would be possible just to convert sdb2 (where my working copy of XP resides, remember I just use sdb1 as a bootloader) from a primary partition to a logical one? It seems like that's where the conflict is.... since I have one primary, and then another one contained in an extended.

Alternatively, I wonder if anyone has any other advice re: imaging. My best option might be to backup everything and just reformat the disk. What I would want to do, but I'm not sure if it's possible, is to image everything on sdb2 and then copy everything back to the space I gained from combining what was sdb1 and sdb2. When copying images, does the size on the disk have to be the same? Or can I dd from my image to the new partition? Would XP be OK with moving around on the disk? Would simply copying boot.ini from XP on sdb1 to XP on sdb2 be sufficient to make it function as a bootloader (after it's re-imaged to the primary partition on sdb1)?

Sorry for all the questions at once... I just have no experience with this stuff. I've run dual boot systems for years without a hitch, so it's all new to me!!

Grant
 
Old 06-14-2011, 04:55 PM   #10
grant or not
LQ Newbie
 
Registered: Nov 2004
Posts: 13

Original Poster
Rep: Reputation: 0
Well, problem solved. All I did was shrink sdb1 with Acronis DD, and, voila, the partition table was restored, with the sdb3 primary partition not part of the sdb2 extended partition anymore. Must have just needed a rewrite. Gparted is able to work it with it just fine. Thanks for everyone's help.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -5. The time now is 11:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration