20

The device map file /boot/grub/device.map is in this format:

(disk) /dev/device

So, for example, on a system with a floppy and a single SCSI disk, the file would look like this:

(fd0) /dev/fd0
(hd0) /dev/sda

I try to display its content :

cat /boot/grub/device.map 

I get this error: No such file or directory

Is it renamed or it is a new hierarchy of Linux system?

muru
  • 207,970

1 Answers1

26

The device map is not installed by default with grub2. You can create a device map by typing the following into your console:

sudo grub-mkdevicemap

This will put device.map into the /boot/grub directory.

Fuzzy Analysis
  • 408
  • 1
  • 7
  • 12
  • 1
    how does linux determine the hdX to sdX mapping before grub-mkdevicemap is run ? – sherpaurgen Feb 07 '19 at 06:37
  • linux uses whatever the grub boot location is in the grub.cfg 'root' property (or similar). http://140.120.7.21/LinuxRef/BootingLinux/Grub2.html – Fuzzy Analysis Feb 20 '19 at 02:59
  • @satch_boogie Linux does not rely on the Grub device map, as clearly shown in the Grub manual. It's the other way around. Grub tries to guess the mapping that Linux chooses by itself. In fact, Linux works fine even without Grub installed. – jpaugh Apr 12 '20 at 23:18
  • When I run grub-customize, it gives me an error if there's not device.map. Your solution is wonderful. And to generate grub.cfg, it's grub-mkconfig. – Quidam Apr 27 '20 at 15:02
  • 1
    But I have the error that says that it's not possible to get the canonical path for /cow when trying grub-mkconfig. – Quidam Apr 27 '20 at 15:06