Next: Writing full configuration files directly, Previous: Simple configuration handling, Up: Writing your own configuration file [Contents][Index]

### 6.2 Root Identifcation Heuristics

If the target operating system uses the Linux kernel, `grub-mkconfig` attempts to identify the root file system via a heuristic algoirthm. This algorithm selects the identification method of the root file system by considering three factors. The first is if an initrd for the target operating system is also present. The second is ‘`GRUB_DISABLE_LINUX_UUID`’ and if set to ‘`true`’, prevents `grub-mkconfig` from identifying the root file system by its UUID. The third is ‘`GRUB_DISABLE_LINUX_PARTUUID`’ and if set to ‘`true`’, prevents `grub-mkconfig` from identifying the root file system via the UUID of its enclosing partition. If the variables are assigned any other value, that value is considered equivalent to ‘`false`’. The variables are also considered to be set to ‘`false`’ if they are not set.

When booting, the Linux kernel will delegate the task of mounting the root filesystem to the initrd. Most initrd images determine the root file system by checking the Linux kernel’s command-line for the ‘`root`’ key and use its value as the identification method of the root file system. To improve the reliability of booting, most initrd images also allow the root file system to be identified by its UUID. Because of this behavior, the `grub-mkconfig` command will set ‘`root`’ to ‘`root=UUID=...`’ to provide the initrd with the filesystem UUID of the root file system.

If no initrd is detected or ‘`GRUB_DISABLE_LINUX_UUID`’ is set to ‘`true`’ then `grub-command` will identify the root filesystem by setting the kernel command-line variable ‘`root`’ to ‘`root=PARTUUID=...`’ unless ‘`GRUB_DISABLE_LINUX_PARTUUID`’ is also set to ‘`true`’. If ‘`GRUB_DISABLE_LINUX_PARTUUID`’ is also set to ‘`true`’, `grub-command` will identify by its Linux device name.

The following table summarizes the behavior of the `grub-mkconfig` command.

Initrd detected | GRUB_DISABLE_LINUX_PARTUUID Set To | GRUB_DISABLE_LINUX_UUID Set To | Linux Root ID Method
--- | --- | --- | ---
false | false | false | part UUID
false | false | true | part UUID
false | true | false | dev name
false | true | true | dev name
true | false | false | fs UUID
true | false | true | part UUID
true | true | false | fs UUID
true | true | true | dev name

Remember, ‘`GRUB_DISABLE_LINUX_PARTUUID`’ and ‘`GRUB_DISABLE_LINUX_UUID`’ are also considered to be set to ‘`false`’ when they are unset.

Next: Writing full configuration files directly, Previous: Simple configuration handling, Up: Writing your own configuration file [Contents][Index]