Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 15
Hi, I had my Linux installed on /dev/hda9, but decided to delete two of the logical partitions before it. First I ensured that all of my fstab was UUID based, ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2010
    Posts
    23

    GRUB and Linux using same partition number??


    Hi,
    I had my Linux installed on /dev/hda9, but decided to delete two of the logical partitions before it. First I ensured that all of my fstab was UUID based, then I shut down Linux, and used a bootable CD to delete the 2 partitions. Now my Linux boot partition is /dev/hda7.

    Since I had not made any changes to GRUB, it obviously failed to boot when I restarted the PC. So I used a GRUB disk to start up. The first command I used was:

    > find /boot/vmlinuz

    To my great surprise, it responded (hd0,7)! According to everything I have read about GRUB, if Linux calls the partition hda7 (the 3rd logical partition), GRUB should call it 8!

    I then continued the boot process with:
    > root (hd0,7)
    > kernel (hd0,7)/boot/vmlinuz root=/dev/hda7
    > boot

    Incredible! It worked!! But how can this be?

    Then I went into the PCLinuxOS Control Center to resave the GRUB definitions for boot, and when I tell it to use /dev/hda7 it automatically puts (hd0, in the GRUB configuration.

    I did get around the problem by manually editing the file, but I would really like to know how this is possible.

    Thanks,
    Shimon

  2. #2
    Just Joined!
    Join Date
    Jul 2010
    Posts
    23
    Obviously I got confused while writing that post - the GRUB value is one LESS than the Linux one, not one MORE.

    So now I am even MORE confused - /dev/hda7 ought to be (hd0,6), no?

  3. #3
    Linux User sgosnell's Avatar
    Join Date
    Oct 2010
    Location
    Baja Oklahoma
    Posts
    486
    Depends on the version of grub. Grub2 starts counting at 1.

  4. #4
    Just Joined!
    Join Date
    Jul 2010
    Posts
    23
    I don't *think* I am using GRUB 2, but how exactly do I check to be sure?

  5. #5
    Linux User sgosnell's Avatar
    Join Date
    Oct 2010
    Location
    Baja Oklahoma
    Posts
    486
    In a terminal, run "grub-install -v". Legacy grub will report itself as .97 or less. Grub2 will be higher, probably 1.98something.

  6. #6
    Just Joined!
    Join Date
    Jul 2010
    Posts
    23
    Thanks for the quick reply!
    $ grub-install -v
    grub-install (GNU GRUB 0.97)

    So we are back to the original question: How can grub (1!) possibly have the same number (0,7) for a partition as Linux's /dev/hda number which is ALSO /dev/hda7?

    Thanks,
    Shimon

  7. #7
    Linux User sgosnell's Avatar
    Join Date
    Oct 2010
    Location
    Baja Oklahoma
    Posts
    486
    According to the grub manual, partition numbers for extended partitions are counted from ‘5’, regardless of the actual number of primary partitions on your hard disk.

  8. #8
    Linux User
    Join Date
    Dec 2007
    Location
    Idaho USA
    Posts
    362
    Are you useing a separate boot partition ?

  9. #9
    Just Joined!
    Join Date
    Jul 2010
    Posts
    23
    sgosnell:
    Sorry, but that is not correct information in my case. As you already showed me, I am running the OLD grub, ver 0.97, but the link in your post is for the manual of Grub2.
    The manual for 0.97 at www gnu org /software/grub/manual/legacy/grub.html#Naming-convention says:
    (hd0,4)

    This specifies the first extended partition of the first hard disk drive. Note that the partition numbers for extended partitions are counted from `4', regardless of the actual number of primary partitions on your hard disk.
    (Unfortunately the terminology here is inaccurate. There can only be ONE "extended partition" on a disk, it is actually a PRIMARY partition used as an envelope for *logical partitions*. So the term that was intended in that quote was "logical", not "extended").

    So, if Grub Legacy counts logical partitions from "4", and Linux counts them from "5", how can the same partition be called "7" by both Linux AND grub??? It obviously cannot be both the 4th (as grub claims) AND the 3rd (as Linux claims) at the same time!!!

    Something is very strange here, IMHO.
    --------
    Lostfarmer:
    No, I have a partition for / and /boot is within that same partition.

    Thanks to you both!
    Shimon

  10. #10
    Linux User sgosnell's Avatar
    Join Date
    Oct 2010
    Location
    Baja Oklahoma
    Posts
    486
    The extended partition is always 4, in either version of grub, AFAIK. It's just the terminology that is confusing. Thus the first logical partition is always 5, and it counts up from there. At least that's the way I understand it, but I could be wrong.

    Exactly which partitions did you delete, in which order?

Page 1 of 2 1 2 LastLast

Posting Permissions

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