GRUB on usb drive for safe booting

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
gambakoker

GRUB on usb drive for safe booting

Post by gambakoker »

Hee people, don't know if this has been posted before. couldn't find it with the search function.

What i want to do:
- Install GRUB on a USB or SD card so i can boot from the usb and choose what OS i want to boot. atm i already have a grub installed on windows disk, but i'll reinstall windows after the grub is on the usb drive.

My configuration:
I have windows installed on the first disk (with grub atm)
Mint on a second hard disk

I have read some articles on the internet but none are really applying to this.
If something needs to be cleared up more please say :)

regards,
gambakoker
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
viking777

Re: GRUB on usb drive for safe booting

Post by viking777 »

http://forums.linuxmint.com/viewtopic.p ... 15#p227881

Would this be any use to you? I know it is not what you are asking for, but it could be an easier solution. I have only tried it in a virtual environment and I haven't tried it in a dual disk evnironment, but I can't see any reason why it would make a difference.

The worst that could happen is that once you reinstall windows you can't boot linux for a bit, but reinstalling grub has got pretty easy these days. Don't let me pressure you though because it would be slightly experimental and I don't want to be twisting your arm to try stuff that I haven't tried myself!
viking777

Re: GRUB on usb drive for safe booting

Post by viking777 »

I managed to find the answer to the question you asked rather than one you didn't, it is actually quite simple.

Plug in your usb key(mount it if not automatically done) note where it is mounted and what drive letter it has (run the command mount to find this info). For the rest of this example I will assume it is mounted at /media/disk and it has the drive letter /dev/sdc.

So.

Code: Select all

sudo grub-install --root-directory=/media/disk /dev/sdc
then

Code: Select all

sudo grub-mkconfig -o /media/disk/boot/grub/grub.cfg
And that is it.

Of course you have to make sure your bios will boot from usb for it to work.
gambakoker

Re: GRUB on usb drive for safe booting

Post by gambakoker »

viking777 wrote:I managed to find the answer to the question you asked rather than one you didn't, it is actually quite simple.

Plug in your usb key(mount it if not automatically done) note where it is mounted and what drive letter it has (run the command mount to find this info). For the rest of this example I will assume it is mounted at /media/disk and it has the drive letter /dev/sdc.

So.

Code: Select all

sudo grub-install --root-directory=/media/disk /dev/sdc
then

Code: Select all

sudo grub-mkconfig -o /media/disk/boot/grub/grub.cfg
And that is it.

Of course you have to make sure your bios will boot from usb for it to work.
Hee, thanks alot for posting! i'm gonna try it right away. Also for in the future does this also work for installing grub to my linux disk, so i can reinstall my windows disk without damaging the linux disk?

regards,

Gambakoker
viking777

Re: GRUB on usb drive for safe booting

Post by viking777 »

Hee, thanks alot for posting! i'm gonna try it right away. Also for in the future does this also work for installing grub to my linux disk, so i can reinstall my windows disk without damaging the linux disk?
My original suggestion would certainly do that (all you would have to do is to move the boot flag back to the Linux partition). Second suggestion? - I don't know. I can only guess, but if you have grub on a usb key then it is difficult to conceive of any way reinstalling windows can affect that - particularly if you unplug it whilst you reinstall windows). The only way you could possibly influence things is if you altered the device map. In other words if you add or subtract a device (by plugging in another drive/usbkey for example) then your device map on the usb key would not match that on the disk and therefore your usb version of grub would no longer boot the installed operating systems. So just make sure that the drives/devices you have plugged in now stay the same or if you alter them then you will have to rebuild your grub usb key so it knows where the new devices are.
Locked

Return to “Installation & Boot”