LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 04-16-2013, 11:38 AM   #1
d-mcclean
LQ Newbie
 
Registered: Jan 2010
Posts: 6

Rep: Reputation: 0
Question Severe partition overlapping problems with quad-boot system


I have a 160 GB hdd w/ 10 partitions and 4 operating systems. They all run fine and I am able to boot into all of them from a grub loader that I installed on sda5, although it shows sda2 as bootable now. I have cloned the entire disk and verified it's integrity. The 4 OS's are as follows; Sparky Linux on /dev/sda1, 2 & 3; Deft Linux on sda5, Peppermint ICE on /dev/sda6 & 7, and PClos on /dev/sda 8,9,10. Here's the output of fdisk;


mint@mint ~ $ sudo fdisk /dev/sda -lu

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 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: 0x000c9611

Device Boot Start End Blocks Id System
/dev/sda1 4095 312576704 156286305 5 Extended
/dev/sda2 * 123785216 195393535 35804160 83 Linux
/dev/sda3 195393536 230549503 17577984 83 Linux
/dev/sda5 4096 55459839 27727872 83 Linux
/dev/sda6 55461888 58058751 1298432 82 Linux swap / Solaris
/dev/sda7 58060800 123785215 32862208 83 Linux
/dev/sda8 230564943 255738734 12586896 83 Linux
/dev/sda9 255738798 262212929 3237066 82 Linux swap / Solaris
/dev/sda10 262212993 312576704 25181856 83 Linux


I know this looks all messed up w/ sda5 residing inside sda1, which is not how I installed it. The only partition that should be extended is sda1 with Sparky. While installing all the OS's I did a manual partition configuration except for PClos. I choose to "install on free space" which should have just been the last 40 G or so. I think the PClos installation is giving me troubles, everything was visible and accurate in gparted prior to that. Now gparted reports the entire disk as unallocated.

I know sfdisk can help me, I've investigated similar problems here and elsewhere on the web, but I'm in no way confident in proceeding with a partition repair. Some more specific advice would be greatly appreciated.

One last thing which I think is pertinent, while running my Sparky Linux, there is a "Deft7" hdd icon on my desktop. It does nothing though when I try to access it.

Thanks in advance for any help.
 
Old 04-16-2013, 12:58 PM   #2
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by d-mcclean View Post
mint@mint ~ $ sudo fdisk /dev/sda -lu

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 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: 0x000c9611

Device Boot Start End Blocks Id System
/dev/sda1 4095 312576704 156286305 5 Extended
/dev/sda2 * 123785216 195393535 35804160 83 Linux
/dev/sda3 195393536 230549503 17577984 83 Linux
/dev/sda5 4096 55459839 27727872 83 Linux
/dev/sda6 55461888 58058751 1298432 82 Linux swap / Solaris
/dev/sda7 58060800 123785215 32862208 83 Linux
/dev/sda8 230564943 255738734 12586896 83 Linux
/dev/sda9 255738798 262212929 3237066 82 Linux swap / Solaris
/dev/sda10 262212993 312576704 25181856 83 Linux
There is nothing wrong with partition 5. Partitions 5 and up are logical drives and can only exist within an extended partition, which is your partition 1. While it is unusual to have partition 1 be an extended partition, there is nothing really wrong about that. And, having partition 2 marked as "active" is irrelevant. Only the standard DOS/Windows boot loader uses that flag. No Linux boot loader pays any attention to it. (Your BIOS might require that some partition be marked "active" in order to consider the drive a candidate for a boot device.)

What is very wrong here is that partitions 2 and 3 are also using space within the extended partition. Primary partitions (partitions 1 through 4) should never be allocated space within the bounds of an extended partition. None of your partitions are actually overlapping, which is why everything works, at least for now. If you ever try to change any of those logical partitions, though, you would have to be very careful not to step on partitions 2 and 3.

I can't come up with any straightforward method of cleaning up this mess other than saving all of the non-swap partitions to another drive (with clonezilla or equiv.), repartitioning this drive from scratch, and then restoring everything and reinstalling the boot loaders.

One alternative might be to make sda1 end at sector 123785215 to include partitions 5, 6, and 7, and then make another extended partition sda4 to include partitions 8, 9, and 10. (Having two extended partitions on a drive is actually OK in Linux. If you want to make it seem less weird, make the second one type 85, "Linux extended".) But, figuring out the right starting offset for sda4 might be a bit of a challenge. From the looks of your current sda1 and sda5, starting sda4 at sector 230564942 would work, but your tool might insist on more than a 1-sector offset before that start of sda8. Fortunately, you've got some space to work with there following the end of sda3 at sector 230549503.

Like I said, not very straightforward. And don't make any mistakes. Placing logical drives at the wrong location can overwrite data (unlike changing primary partitions, which can always be reversed).

Last edited by rknichols; 04-16-2013 at 01:01 PM.
 
2 members found this post helpful.
Old 04-16-2013, 01:26 PM   #3
d-mcclean
LQ Newbie
 
Registered: Jan 2010
Posts: 6

Original Poster
Rep: Reputation: 0
Thanks. I appreciate your know-how.
 
Old 04-16-2013, 02:02 PM   #4
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
I would be interested to know how you managed to get sda2 and sda3 inside an extended partition (sda1)? I wouldn't even know how to accomplish that feat, not that anyone would normally want to. With Linux, your logical partitions inside the extended partition would normally start with the first being identified as sda5, and go up in number from there. So what the heck are sda2 and sda3 doing there, inside the extended partition??? Their start and end blocks are OK and fit within the extended partition without overlapping anything else, but what I don't understand is why they are being designated as sda2 and sda3.
 
Old 04-16-2013, 08:42 PM   #5
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Oh, it's easy enough to see how they could exist that way. Partitions 2 and 3 exist in the primary partition table, and not as a part of the linked list of partition headers that make up the logical partitions within the extended partition. Since each of those headers contains a pointer to the next, there is no inherent guarantee that the logical partitions are adjacent or even in order by ascending starting offset.

As for how it got that way, I just did some playing with sfdisk and, by ignoring an "I don't like this" warning, was able to create a very similar partition layout on an empty drive I had available.
Code:
   Device Boot    Start       End   #sectors  Id  System
/dev/sdd1          1024  97676023   97675000   5  Extended
/dev/sdd2      25000000  49999999   25000000  83  Linux
/dev/sdd3      50000000  64999999   15000000  83  Linux
/dev/sdd4             1      1023       1023  83  Linux
/dev/sdd5          1032  10001031   10000000  83  Linux
/dev/sdd6      65001024  75001023   10000000  83  Linux
/dev/sdd7      75002048  97676023   22673976  83  Linux
Delete partition 4, and it's the same sort of arrangement. Highly not recommended.
 
  


Reply

Tags
partition recovery, sfdisk



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
"yum update" caused severe problems to my system (rhel4, x86_64) saak.stepi Linux - Hardware 6 04-07-2008 12:21 PM
"yum update" caused severe problems to my system (rhel4, x86_64) saak.stepi Linux - Software 6 04-04-2008 04:21 PM
Quad-boot System: Doomed or Destined? xanderfoxx Linux - Distributions 4 10-16-2007 11:52 PM
partition troubles galore with linux/windows quad boot suicideguy Linux - Newbie 8 01-07-2007 11:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 11:18 AM.

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
Open Source Consulting | Domain Registration