GRUB on usb drive for safe booting

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read this

GRUB on usb drive for safe booting

Postby gambakoker on Thu Feb 11, 2010 6:47 am

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
gambakoker
Level 1
Level 1
 
Posts: 10
Joined: Sat Jan 16, 2010 10:38 am

Linux Mint is funded by ads and donations.
 

Re: GRUB on usb drive for safe booting

Postby viking777 on Thu Feb 11, 2010 7:37 am

http://forums.linuxmint.com/viewtopic.php?f=46&t=39144&hilit=mbr&start=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!
Fujitsu Lifebook AH532. Intel i5 processor, 6Gb ram, Intel HD3000 graphics, Intel Audio/wifi. Realtek RTL8111/8168B Ethernet.Lubuntu 13.10,Ubuntu12.10 (Unity), Mint16 (Cinnamon), Manjaro (Xfce).
Image
User avatar
viking777
Level 14
Level 14
 
Posts: 5153
Joined: Mon Dec 01, 2008 11:21 am

Re: GRUB on usb drive for safe booting

Postby viking777 on Fri Feb 12, 2010 6:10 am

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.
Fujitsu Lifebook AH532. Intel i5 processor, 6Gb ram, Intel HD3000 graphics, Intel Audio/wifi. Realtek RTL8111/8168B Ethernet.Lubuntu 13.10,Ubuntu12.10 (Unity), Mint16 (Cinnamon), Manjaro (Xfce).
Image
User avatar
viking777
Level 14
Level 14
 
Posts: 5153
Joined: Mon Dec 01, 2008 11:21 am

Re: GRUB on usb drive for safe booting

Postby gambakoker on Fri Feb 12, 2010 12:36 pm

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
gambakoker
Level 1
Level 1
 
Posts: 10
Joined: Sat Jan 16, 2010 10:38 am

Re: GRUB on usb drive for safe booting

Postby viking777 on Fri Feb 12, 2010 1:16 pm

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.
Fujitsu Lifebook AH532. Intel i5 processor, 6Gb ram, Intel HD3000 graphics, Intel Audio/wifi. Realtek RTL8111/8168B Ethernet.Lubuntu 13.10,Ubuntu12.10 (Unity), Mint16 (Cinnamon), Manjaro (Xfce).
Image
User avatar
viking777
Level 14
Level 14
 
Posts: 5153
Joined: Mon Dec 01, 2008 11:21 am


Return to Installation & Boot

Who is online

Users browsing this forum: Google Adsense [Bot], lostfarmer and 12 guests