What is my partition number?

2

0

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

Deniz Zoeteman

Posted 2010-01-07T18:37:40.727

Reputation: 1 001

Answers

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.

quack quixote

Posted 2010-01-07T18:37:40.727

Reputation: 37 382

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 – 2010-02-20T07:03:42.703

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.

Joshua Nurczyk

Posted 2010-01-07T18:37:40.727

Reputation: 2 316

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> 

Sean Madden

Posted 2010-01-07T18:37:40.727

Reputation: 131