Find the answer to your Linux question:
Page 2 of 2 FirstFirst 1 2
Results 11 to 15 of 15
> The extended partition is always 4, in either version of grub, AFAIK . > Thus the first logical partition is always 5 This is apparently not correct. I found ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #11
    Just Joined!
    Join Date
    Jul 2010
    Posts
    23

    > The extended partition is always 4, in either version of grub, AFAIK.
    > Thus the first logical partition is always 5

    This is apparently not correct. I found a clear explanation of Grub's (Legacy) naming at www novell com /documentation/suse91/suselinux-adminguide/html/ch07s04.html which states explicitely:
    The four primary partitions allowed per disk are numbered from 0 to 3. Logical partitions are counted beginning with 4.

    (hd0,0) first primary partition on first hard disk
    (hd0,1) second primary partition
    (hd0,2) third primary partition
    (hd0,3) fourth primary partition (usually an extended partition)
    (hd0,4) first logical partition
    (hd0,5) second logical partition ...

    So, since my boot partition is on the third logical, and Linux calls it /dev/hda7,
    Grub SHOULD be calling it (hd0,6), rather than the weird (hd0,7) that I am getting.

    I deleted the first and second logical partitions. So what had been called by Linux "hda5" and "hda6" no longer exist. There is free space before the first logical partition. What used to be the third logical (after the two that I deleted), "hda7" is now "hda5". So... the logical that used to be hda9 (when it was the fifth) has now become "hda7" - that is my boot partition.

  2. #12
    Just Joined!
    Join Date
    Jul 2010
    Posts
    23
    Is there something like Norton Diskedit for Linux? Something to allow me to actually see the sectors with the partition tables, preferably in a formatted layout as a partition table? I would like to work my way through them myself, and see what is going on!

  3. #13
    Just Joined!
    Join Date
    Jul 2010
    Posts
    23
    Hmmm... I think I may be on to something, and if I am correct, it might even be considered a bug (although that is of no real value to anyone in a "legacy" program).

    Using # dd if=/dev/hda count=1 | hexdump -C
    to read the partition table in the MBR, and then using the sector number to get to the boot sector of the extended partition, I saw something interesting.

    Generally, logical partitions are chained. That is, MBR->Extended, Extended contains 1 logical, and also points to next "extended" (which is really embedded within the 1 true primary extended partition. And so on, the second, logical extended points to the next embedded logical extended partition, which will also contain ONE logical data partition, and a pointer to the next, etc.

    But, my first extended partition seems to just point to the next logical extended, with no actual data partition at all. If I am understanding this correctly, when the first logical partition was deleted, the chain of extended partitions was not rewritten to skip it. Instead, the first one just points directly to the second one.

    Then, if Grub is NOT really counting *partitions*, but is counting "hops", how many times it read an extended partition, then it might have one more in its chain then actually exist. Wouldn't that be a bug?

    In any case, I am not finished my exploration, plus there is the question of why wouldn't grub still remember BOTH of my deleted partitions, instead of only ONE of them....

    Comments on that idea, anyone? Well, I will do more investigation later.

    Thanks,
    Shimon

  4. $spacer_open
    $spacer_close
  5. #14
    Linux User
    Join Date
    Dec 2007
    Location
    Idaho USA
    Posts
    362
    But, my first extended partition seems to just point to the next logical extended, with no actual data partition at all.
    That does not completly suprise me. Different partition software does do things differently. Lets say you now add a logical volume in the unused space, some programs will make the new partition sda5 but others will give it (last logical volume +1) .

    Lets talk with the same terminalogy - 'extended partition above' lets use EPT1 'extended partition table #1' and the next would be EPT2 and so on.

    So the MBR's 'W95 Ext'd (LBA)' points to EPT1 , which in turn points only to EPT2. Does EPT2 only points to EPT3 or does it contain pointer to it's logical volume ?

    Instead of using 'dd' , you can see the data with 'fdisk /dev/xxx' where xxx= the hdd number. Then select advanced option "x", then 'd' print raw MBR data. That will list the MBR and all EPT's in raw data.

    Can you post output of 'fdisk -lu'. u=change output from blocks to sectors.

  6. #15
    Just Joined!
    Join Date
    Jul 2010
    Posts
    23
    Sorry I have been away from the forum for a few days.

    I tried fdisk advanced option raw view, and did NOT see the empty table!
    This worried me, since in raw dd I was sure it was there.

    But then I tried your suggestion of fdisk -lu, and got THIS:
    # fdisk -lu /dev/hda
    omitting empty partition (5)

    Disk /dev/hda: 80.0 GB, 80026361856 bytes
    255 heads, 63 sectors/track, 9729 cylinders, total 156301488 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Disk identifier: 0x47b986dd

    Device Boot Start End Blocks Id System
    /dev/hda1 63 6442064 3221001 83 Linux
    /dev/hda2 6442065 153629594 73593765 f W95 Ext'd (LBA)
    etc...

    So, voila!! fdisk itself tells me that there is an "empty partition",
    which is #5! I think this shows that we really have correctly understood
    the problem. Each EPT "defines" a partition, so Grub is counting the
    "empty" one too, while Linux, like fdisk, is skipping it.

    Thanks very much for the help!!
    Shimon

Page 2 of 2 FirstFirst 1 2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •