12

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?

16

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.

| improve this answer | |
  • how does linux determine the hdX to sdX mapping before grub-mkdevicemap is run ? – satch_boogie Feb 7 '19 at 6:37
  • linux uses whatever the grub boot location is in the grub.cfg 'root' property (or similar). 140.120.7.21/LinuxRef/BootingLinux/Grub2.html – Fuzzy Analysis Feb 20 '19 at 2: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 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 at 15:02
  • 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 at 15:06

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.