USB Stick Query

Home » CentOS » USB Stick Query
CentOS 7 Comments

I have a working CentOS-7 machine. I want to install grub2 on a USB stick
(without altering my present system in any way)
so that I can boot the present system from the USB stick.

Could some kind (and expert) soul explain precisely what to do.

If it were possible to boot other systems on the computer as well that would be an added bonus.

I did google for this, but all the sites I saw wanted to do more than I am asking. I also tried “sudo grub2-install /dev/sdb”
but for some reason this did not do the trick.

7 thoughts on - USB Stick Query

  • That should place a boot loader on sdb that will boot the system. What behavior did you observe when you tried to boot from that USB drive?

  • Gordon Messmer wrote:

    I’ve tried this again, and it does not seem to work. Have you actually tried it?

  • I don’t have a CentOS system here that I can reboot readily. And it occurs to me that if I did, I didn’t ask if your system boots via BIOS
    or UEFI. If it’s BIOS, I do have a test system at the office I could use to look at that further.

    If it’s UEFI, then you’d need to set up a system partition in addition to running grub2-install.

  • Gordon Messmer wrote:

    Thanks for your response. It boots via BIOS, and in fact boots into CentOS-7/KDE on a USB stick
    (that is how I installed CentOS-7), and into Fedora-21/KDE on a stick.

    But it doesn’t boot back into the CentOS-7 system that is normally running if I say “sudo grub2-install /dev/sdc” (the USB stick is sdc). It just comes up with the repeated “-“, which I take to mean it has found the boot-loader on the USB stick, but has not found the kernel on /dev/sda6.

  • i think that command is ambiguous because there’s four distinct parts to GRUB. The boot.img goes in the MBR (or GPT BIOS Boot partition), which is all the /dev/sdc is telling it; the core.img and the extra modules have to go in a directory on that same device. So you have to tell it where. And in that same directory you need to put a grub.cfg, using grub2-mkconfig. http://www.gnu.org/software/grub/manual/grub.html#Invoking-grub_002dinstall

    Such as this example where you have, /dev/sdb1 as ext4 with a boot/
    directory on it, and you’ve mounted it at /mnt

    grub-install –boot-directory=/mnt/boot /dev/sdc

    Another possibility is using grub2-mkrescue. http://www.gnu.org/software/grub/manual/grub.html#Invoking-grub_002dmkrescue

  • Chris Murphy wrote:

    I have to confess that on using another USB stick, re-formating it under Windows-7, creating partitions with fdisk, and running “sudo grub2-install /dev/sdc”, the USB stick did boot my CentOS-7 machine into its usual system.

    I checked the first 4 x 512 bytes on the two sticks, and they did differ in the first 512 bytes, but I haven’t analyzed the difference.