[SOLVED] Severe partition overlapping problems with quad-boot system
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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).
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.