LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   USB GRUB Select different Operating Systems (https://www.linuxquestions.org/questions/linux-newbie-8/usb-grub-select-different-operating-systems-4175464088/)

SamSlam023 05-30-2013 06:42 AM

USB GRUB Select different Operating Systems
 
I recently had the idea to have a USB with with gparted, clonezilla, win 7 install partitions and use GRUB to select which os I want to boot into. This will save me having to burn discs and temporarily install a cd drive into computers.

I have a little experience with linux and even less with GRUB.

Firstly, can this be done?

I have tried many guides on doing this but something always goes wrong.

What I do is, format a ext2 partition on the USB then give it a file system and mount it.

This is when I start to run into problems. I have an Ubuntu server running. I copy /boot/grub into usbmount/boot/

The problem is, the tutorial asks me to edit menu.lst which doesn't exist in my situation. I also cant find some other things that are mentioned in tutorials such as stage1. I have tried looking in the grub folder of mint and ubuntu desktop and still could not find them. I tried just making my own menu.lst file and continue from there but that still did not work.

These are the guides that I have been trying to follow.

http://ubuntuforums.org/showthread.php?t=1163686

http://forums.opensuse.org/english/g...usb-drive.html

Is there a way for me to get this working? Or is there a better way of going about this?

eSelix 05-30-2013 07:01 AM

Maybe use "syslinux" for that. I think with grub this is also possible, but I did not tested it. First you need to make your flash drive bootable, for example I used "unetbootin" to copy Ubuntu and syslinux to pendrive. Next you should look into config file "syslinux.cfg" in main directory, there are instructions for bootloader what to do. Displaying menu, submenu, colors, etc. you can move system images to own directories and edit config file accordingly.

yancek 05-30-2013 08:56 AM

The first problem you are having is that you are using Ubuntu with Grub2 installed and reading/using tutorials meant for Grub Legacy. Note the dates on the tutorials. Are you wanting to just have the GParted and Clonezilla Live CDs on a flash. That should be pretty easy with either Grub Legacy or Grub2, or Syslinux. Are you planning to use Grub2?

After creating the partition on the flash drive and formatting it, I would suggest you create a boot directory and a grub sub-directory under boot and copy the files from /usr/lib/grub/i386pc to the Grub directory you created. You will need to manually create a grub.cfg file or you can copy the grub.cfg file from your installed system and remove all of the menuentry lines and create new entries for gparted and clonezilla.

After doing that, loop mount gparted and clonezilla and copy the directories/files from each to the root of the flash drive. Open the isolinux.cfg or syslinux.cfg file to look at the entries there. You will need to copy and modify them to work in Grub2.

Below is an entry I used to boot Clonezilla from a flash. You may need to change the set root entry from (hd0,) as well as the bootfrom=/dev/sdb1 is sdb1 is not what your flash shows as.

Quote:

menuentry "Clonezilla" {
set root=(hd0,1)
linux /live-hd/vmlinuz boot=live live-config noswap nolocales edd=on nomodeset ocs_live_run=\"ocs-live-general\" ocs_live_extra_param=\"\" ocs_live_keymap=\"\" ocs_live_batch=\"no\" ocs_lang=\"\" ip=frommedia nosplash live-media-path=/live-hd bootfrom=/dev/sdb1 toram=filesystem.squashfs
initrd /live-hd/initrd.img
}
Repeat the process for GParted and then install Grub2 to the mbr of the flash drive.

I'm not sure what you mean by a win 7 install partition, just the install CD??

SamSlam023 05-31-2013 08:53 PM

Thank you, I'll give that a go today.

Yes, just the Windows install CD. Would this be the same process as adding gparted? I imagine this would get kinda messy as we are installing these all on the same partition.

It might also be useful to have an actual install of ubuntu desktop or mint (not a live cd) on the USB. I managed to do this with another USB so I could use this program at school to program my Arduino. Would this be too difficult to get working on the same USB with clonezilla and gparted?

I will try to just get clonezilla and gparted working today and work on adding windows install and mint later...

SamSlam023 05-31-2013 09:18 PM

Also I am happy to use any bootloader. I would prefer to use Grub2 as most things use that (I think) so it might be useful learning how that works.

yancek 05-31-2013 10:23 PM

Grub2 will work for what you intend. I have no idea about windows as I rarely use it and have never tried to put it on a flash drive.
You should be able to do an actual install of Ubuntu plus the Live CD installs of clonezilla and gparted, even on the same partition. Bear in mind that a full install of Ubuntu or Mint will take about 5GB so you will need an 8GB flash or larger, probably larger if you are going to windows on it although I have no idea how large a windows install CD/DVD is. If you want a full install of Ubuntu/Mint on the flash, just make sure you select the correct drive/partition and install Grub2 to the mbr of the flash which will eliminate the need to do the copying of grub files I refer to above with clonezilla and gparted.

SamSlam023 06-01-2013 02:43 AM

Would I have different partitions for clonezilla and gparted and change the partition in the menu entry where it says "bootfrom=dev/sde1" for each?

SamSlam023 06-01-2013 05:52 AM

I installed ubuntu desktop 12.04 to the USB. I made a ext2 partition on the usb (sdd2) and made the filesystem ext2. I mounted that partition and copied all the contents of my cloneszilla live cd onto the sdd2 partition. I then edited the grub.cfg on the ubuntu partition (sdd1) in /boot/grub. This was when I was not sure of. I found a part where it had other menu entries and added the one you made. I changed bootfrom to sdd2 and left hd0. How do I check what root entry to use? Also do I need to edit the grub.cfg to actually display my boot options or something?

yancek 06-01-2013 03:25 PM

Quote:

Would I have different partitions for clonezilla and gparted and change the partition in the menu entry where it says "bootfrom=dev/sde1" for each?
I don't have Clonezilla or Gparted iso files to check. What you could do is create a mount point for each and loop mount them and compare the directories/files in the root of each filesystem. In the directory where Clonezilla/Gparted are create the mount point: sudo mkdir clonezilla. sudo mkdir gparted. Then loop mount: mount -o loop clonezilla.iso clonezilla. You need the exact name of the clonezilla iso. The same for gparted. Compare the directories/files. If their are files with the same name, you should put them on separate partitions.

How are you trying to boot the flash drive? Do you set it to first boot priority in the BIOS.
Change the set root to (hd0,2). I'm not sure that will work and don't know why it worked when I did it. If it was on sdb2 the root entry should have been (hd1,2)?? You will need to look in the isolinux.cfg file for Gparted. The entry for clonezilla is not likely to work.

The menu you see when you boot a system with Grub is what you have in the grub.cfg file, the individual menuentry sections so yes, that is what you need to edit.
I remember having more difficulty getting Clonezilla to boot than any other system I tried. About the only thing I could suggest it try different options. You might go to the Clonezilla forums and see what you can find. That's where I got the entry I posted above but, unfortunately I no longer have the link.


All times are GMT -5. The time now is 03:26 AM.