Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am using Linux and i need to restore my grub, so i go into commandline on live CD, and i enter 'grub', then 'root (hd0,6)', but it says that the disk does not exist. This is how everything looks like:

-unallocated

-dev/sda1

-dev/sda2

-dev/sda3

  • /dev/sda5
  • unallocated
  • /dev/sda7 -- This is the partition i need the number from!
  • /dev/sda8
  • /dev/sda6

That's how it looks like in Gparted. (all on one harddisk.)

(everything with a dot is a partition in a partition (dev/sda3))

share|improve this question
add comment

3 Answers

up vote 3 down vote accepted

You may just have to experiment.

Using Grub's commandline tab-completion can help show you what Grub is seeing. By default Grub is probably numbering the partitions in order, starting from (hd0,0), like this:

  • (hd0,0) -- /dev/sda1
  • (hd0,1) -- /dev/sda2
  • not numbered -- /dev/sda3
    • (hd0,2) -- /dev/sda5
    • not numbered -- unallocated
    • (hd0,3) -- /dev/sda7
    • (hd0,4) -- /dev/sda8
    • (hd0,5) -- /dev/sda6

Based on this, (hd0,3) is your best bet.

This assumes your ordering in the question is how partitions are physically ordered on the disc. In particular, this is how your drive should appear under Grub v1; Grub v2's enumeration may differ.

share|improve this answer
    
in fact, Grub2 numbers partitions starting at 1, so the numbers should match the /dev/sdaN nodes. thus in Grub2, /dev/sda1 is seen as (hd0,1) ; /dev/sda2 as (hd0,2) , etc. –  quack quixote Feb 20 '10 at 7:03
add comment

Have you tried typing "root (" and hitting tab to list the disks? You should be able to list the disks and count to see if maybe sda7 is showing up as (hd0,5) or something weird.

share|improve this answer
add comment

If you're looking to locate the grub boot files, you can use the 'find command' to determine the partition type.

For example:

grub> find /grub/stage1
find /grub/stage1
 (hd0,0)
grub> 
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.