2

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))

3 Answers 3

4

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.

1
  • 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. Commented Feb 20, 2010 at 7:03
1

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.

1

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> 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .