Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I placed a entry like this in grub4dos,

rootnoverify (hd1)
chainloader +1
boot

But sometimes when I plug in my USB key too late, grub will not detect this usb key, is there anyway to let grub re-scan disk list?

I need to know for both grub0.9X and grub1.9X

share|improve this question

Run the following command as root:

update-grub

EDIT: This is an Ubuntu specific command. To do this on another distribution, just run grub-mkconfig -o /boot/grub/grub.cfg

share|improve this answer

From what I've seen, I don't believe this is possible. I was in a similar situation where I setup a GRUB entry to boot from a USB. If I didn't have a USB stick in before startup, the boot option fails. If I boot with the USB stick already connected, the option would boot from the USB.

Using GRUB 0.97, I've scanned the manual and tried many commands but I didn't see anything related to re-initializing the disks.

I see many hints in the manual that GRUB relies on the BIOS (if not entirely). When playing with boot options from the BIOS, it's in the same situation where if I don't have the USB stick plugged in before BIOS starts, it will never be listed as a bootable option (using AMI, Aptio). Maybe this is a BIOS limitation, a limitation of both or I could just strayed on a tangent.

I thought this was going to be an issue for me, but then I wondered what was easier: having someone toggle to the GRUB command mode and reinitialize disks or just CTRL-ALT-DEL'ing...

share|improve this answer

Grub does not provide an explicit command to rescan drives, but the drives will be rescanned if the computer is rebooted from within grub. To do this:

  • At the grub menu, press c to drop to the grub console
  • Type reboot and hit enter
  • Computer will reboot
  • Grub will be reloaded and the drives will be rescanned
share|improve this answer

yes; reboot.mod in grub ==ctrl-alt-del in common PC's.

The reason why a "late plugin usbstick" not recognised is due to hotplug concept! Since grub is at very early boot no driver for hotplug could be available.

A very simple experiment to illustrate:

  1. get 2 usbsticks with at least one with grub bootable
  2. start the pc with the bootable stick
  3. on grub's menu, type c to get into grub console
  4. grub>ls to display all drives seen by grub
  5. Plugin the 2nd stick
  6. grub>ls will see no change
  7. grub>reboot, then
  8. grub>ls will see the 2 sticks

Even in the future, hotplug will never exist in grub.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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