6

Referring to here, with a configuration as

grub> root (hd0,0) grub> kernel /vmlinuz-i686-up-4GB root=/dev/hda9 grub> boot 

The preceding is usually sufficient to boot a Linux box. The standalone root statement tells the partition containing the kernel. The kernel statement describes the path and filename, within the partition containing the kernel, of the kernel. The argument to the root= argument to the kernel statement tells the partition containing /sbin/init, which of course turns out to be the root partition in the booted system.

Be careful of these duelling root keywords. The standalone one is the root as seen from grub, and contains the kernel. The argument to the kernel statement is the root as seen from the fully booted system, and contains /sbin/init.

I don't quite get the meaning of the 2 root configs. Does it mean the OS stays on /dev/hda9 to be mounted on (hd0, 0), or the OS is /vmlinuz to be mounted to /dev/had9 ?

1
  • If anyone reading this has the rep for a 1-character edit, the linked URL can now be updated from http to https. Commented Feb 20 at 12:11

2 Answers 2

2

The way I have my system, on /dev/sda1-3. The first partition of my hardisk is sda1 and contains the boot partition. I have a swap drive in sda2. I have my main partition in sda3. Sda3 holds the root "/" directory and all its subdirectories like /etc, and /usr.

In my Grub.cfg I have set

set root=(hostdisk//dev/sda,gpt1) 

This lets the bootloader find the kernel files before any filesystem is ready. Technically you are booting sda1.

When the kernel loads and mounts the drives in the fstab, root "/" itself is on sda3, but /boot (the files that booted) are mounted to sda1.

linux /kernel-genkernel-x86_64-4.9.144-3 root=/dev/sda3 real_root=/dev/sda3 rootfstype=ext4 initrd /early_ucode.cpio /initramfs-genkernel-x86_64-4.9.144-3 

So even though the system booted with the files on sda1, the root "/" is really on sda3.

1

root (hd0,0) - Configures the root partition for GRUB, such as (hd0,0) first hard disk, first Partition and mounts the partition.

kernel /vmlinuz-i686-up-4GB root=/dev/hda9 - Specifies the kernel location which is inside the /boot folder. This location is related to the root(hd0,0) statement.The root partition is specified according to the Linux naming convention (/dev/hda9/)

The Kernel image will be mounted on root file system (/dev/hda9)

4
  • 4
    The kernel image isn't "mounted on [the] root file system", the root file system is (by the kernel). :-) Commented Jan 15, 2016 at 12:10
  • 2
    Basically root= tells the partition containing /sbin/init, which of course turns out to be the root partition in the booted system. Commented Jan 15, 2016 at 12:16
  • Can you elaborate ? You mentioned the root partion as (hd0,0) and later said the root partition /dev/hda9. The root partition for GRUB, from my understanding, is where the GRUb config files stays. But it has nothing to do with where the OS is. For example here, GRUB config is read from (hd0,0), the OS is in /vmlinuz which will be mounted at /dev/hda9 Commented Jan 15, 2016 at 14:04
  • 2
    @Kenny root(hd0,0) tells the grub where it's configuration files are located. In this case, they can be found under (hd0,0)/boot/grub. And, kernel /vmlinuz-i686-up-4GB root=/dev/hda9 specifies the actual kernel image location from where it can be read, which is inside the /boot folder. There can be many kernel images. root=/dev/hda9 specifies the location of your root ( "/") partition of the OS. Commented Jan 16, 2016 at 5:21

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.