i am playing with grub and i change the root using:

root (hda,x)

how can i know what's x for /dev/sda7 ?

fdisk -l

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1958    15727603+   7  HPFS/NTFS
/dev/sda2            1959        7476    44323335    f  W95 Ext'd (LBA)
/dev/sda5            1959        4569    20972826    7  HPFS/NTFS
/dev/sda6            4570        5352     6289416   83  Linux
/dev/sda7            6373        7119     6000246   83  Linux
/dev/sda8            7120        7476     2867571   83  Linux
/dev/sda9            5353        6135     6289416   83  Linux
/dev/sda10           6136        6372     1903671   82  Linux swap / Solaris

the problem is that in Gparted view, the order is not like sda5, sda6, sda7, ... but the order is like:

  • sda6
  • sda9
  • sda10
  • sda7
  • sda8

so what's x for /dev/sda7 ?

2 Answers 2


First off, you need to realize that in grub, it does not use normal linux hard drive identifiers. Instead, the letters correlate to numbers, starting with zero (i.e. hda = hd0, hdb = hd1, etc).

Secondly, in grub-legacy, the partition number starts at 0, not 1 like in Linux, so subtract 1 from the linux partition number. And in grub2, it starts at 1.

An example is: hda1 = (hd0, 0)

Finally, grub does not differentiate between hd and sd devices, so everything is labeled hd.

Thus, in your case, your grub entry for /dev/sda6 should read (hd0, 5)


Easiest way to be sure is from grub cli and using tab completion.

start by typing... root (hd0,

then hit [tab]
The tab completion should then list the partitions available. pick the one you think makes most sense close off the parentheses and on the next line type kernel /

then hit [tab] again... if the files and directory structure look right you picked the right one... if not.. back up and redo the root line.

  • Did not work for me, using openSUSE Leap 42.1 and GRUB Legacy (GRUB 0.97) Sep 26, 2016 at 1:34
  • This is helpful in my situation but my partitions (I have 11) list scrolled off-screen and I can't SHIFT+PGUP to see the first ones. Is there a way to list the partitions specifically? like type (hd1,gpt2) or something? Jul 31, 2017 at 13:29
  • 3
    I just found a set pager=1 command. I think that will work, never mind. Jul 31, 2017 at 13:32
  • 1
    From grub cli, you can also type ls to list available drives and partitions
    – sayanel
    Oct 14, 2022 at 15:37
  • @fymita How do I enter a grub cli inside my Linux box? I mean, not at boot time, but when using a terminal. Is it possible?
    – LobaLuna
    Dec 31, 2022 at 22:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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