How To Make A Windows and Linux Multiboot USB Flash Drive Part 2 (How I did it)
Read part 1 of my article here first
How I did it
I would suggest that you do things in the following order, as re-sizing and re-partitioning seems to cause some confusion to Knoppix;
In Windows XP, use UBUSB.exe This will make your drive bootable into a live windows system, with Grub4Dos already installed. The windows live system will be on a single partition.
Boot from your Knoppx live CD and use gparted to resize this partition to about 2Gb. This will leave plenty of room for some useful extra tools etc. for when you are using the drive as a “normal” drive in a Windows operating system. (You may get an error message telling you that the operation failed. Ignore it, it is most likely OK, but when the operation has finished, reboot into Knoppix so your system is happy with the change.
Now, create a new extended partition using all the remaining available room, and create 5 or 6 logical partitions from it. I used about 800Mb for most of them, but made one of them 1Gb as one of the ISO’s I wanted to put on was too big for a CD – it was nearly 900 Mb. I formatted each of these with FAT32 file systems. Again, reboot into Knoppix, so the system sees all the changes properly.
Next, use the dd command (see above) to copy iso images you have stored on your hard drive, or just use your existing Linux CD’s. and copy them using dd. (Remember to alter the path for “dd if=/…..” accordingly.) Notice the speech marks ” ” which are necessary if the path on your drive has spaces in it “Documents and Settings” for example. The dd command won’t understand the path without them. I would suggest copying the iso’s one at a time, and getting the flash drive working with each one, adding to them as you succeed with each. It saves a lot of time if you go wrong and have to start all over again!
Check in gparted that the flag “boot” is set to your first partition (the one with the live windows system on it) otherwise when you try to reboot your system with the flash drive, it won’t work.
Creating the menu
Now the fun part! Either use a text editor in Knoppix or use your Windows XP normal operating system to edit the file “Menu.lst” which, together with grldr, shoud be on the main first partition for your drive along with the windows live files. (This partition should be the only one visible in your windows xp operating system.) Menu.lst is a normal text file, and is grub’s menu list. It will need to reflect what is where on your flash drive. Grub is like a mini operating system, and if you boot into it and press c, you will be able to use the command line to see what is where on the various partitions. (If I remember correctly, grub is case sensitive so typng C instead of c will not work!)
Knoppix shows the partitions on the desktop and in gparted as sda1, sda2 etc, but grub understands them as (hd0,0), (hd0,1) etc, meaning (drive 1,partition 1), (drive 1,partition2). Notice that Knoppix starts at number 1 for the first drive/partition, and grub starts at 0 for the first drive/partition!
As a guide, my Grub4Dos Menu is shown on the “my Menu.lst page” on this page, along with an example of the Linux vs Grub naming system.
Working out what to put in the menu was tricky at first, until I found a site where I learned that all the information is in a file on each of the iso’s called isolinux.cfg You just need to note the information (leave it where it is!) and use it to help you make your own Menu.lst for grub. Compare my menu (see the “my Menu.lst” page) with the isolinux.cfg file in the relevant iso’s of your own and you will see what I mean. You can look in your iso’s using something like winrar in Windows XP.
Note from my list that the first command in all the “blocks” is “title”. This can be followed by anything you like, and will be displayed when you boot your system from the flash drive, so make it meaningful to you! To load into the Windows Live system the command on the second line is chainloader, but to load into all the Linux Systems (which the others are) the first command on the second line is kernel, and the first command on the third line is initrd.
I hope you find this guide useful. Like I said, in no way is it meant to be a full tutorial. it just has some tips in it which I found really difficult to find or work out. Use this guide in conjunction with the programmes own manuals and other sites and forums. Making this bootable flash drive is fairly easy – when you know how!!! It has taken me literally hours and hours to get to this point!
My Menu.lst file
title BackTrack 3 Graphics mode (VESA KDE)
kernel (hd0,4)/boot/vmlinuz vga=0×317 ramdisk_size=6666 root=/dev/ram0 rw autoexec=kdm
title Knoppix V5.1
kernel (hd0,5)/boot/isolinux/linux ramdisk_size=100000 init=/etc/init
kernel (hd0,6)/boot/vmlinuz ramdisk_size=6666 root=/dev/ram0 autoexec=xconf;startx changes=/slax/
kernel (hd0,7)/boot/vmlinuz vga791 max_loop=255 ramdisk_size=6666 root=/dev/ram0
title BackTrack 4 Beta
kernel (hd0,9)/boot/vmlinuz ramdisk_size=6666 root=/dev/ram0
The first “block” can be left out altogether. The first line is just a command to put the splashimage “hubble.xpm.gz” which is located on the first partition in the “MyFiles” folder, on the screen behind the menu. Yes, this DOES work in Grub4Dos! The next two commands set the foreground and background colours of the menu text.
Partition 8 is currently empty.
Below is how grub sees the drives, compared to how Knoppix sees them. In this case, Knoppix was booted from a live CD so I could work on the flash drive. Then, the computer was booted from the flash drive so I could compare how grub saw the same thing.
In Knoppix, sda1 is equivalent to (hd0,0) and means “first drive (i.e. flash drive), first partition”
In Knopix, sda2 is equivalent to Grubs (hd0,1) and means “first drive, second partition”
In Knoppix, sda3 is equivalent to Grubs (hd0,2) and means “first drive, third partition”
Do remember that when you boot from your flash drive to check that things are working and to find out where things are by using grubs command line, your flash drive and not your normal hard drive is (hd0)! The first partition on my normal hard drive in this case is (hd1,0) which grub takes to mean the second drive, first partition!
Good luck - please let me know how you get on!
More by this Author
Did everything really evolve out of nothing?
Creating a Windows and Linux Multiboot Flash Drive. Not easy, but it can be done!
For several years now, I have been toying with the idea of using capacitors, instead of batteries, to store power. During that time, technology has moved on, and "super-capacitors" or "ultra...
No comments yet.