openSUSE Forums > Archives > SF Archives > ARCHIVES - Tips, Tricks & Tweaks » 4gb Flash Drive With Multiple Bootable Linux Oses (part 1)

Go Back   openSUSE Forums > Archives > SF Archives > ARCHIVES - Tips, Tricks & Tweaks
Forums FAQ Members List Search Today's Posts Mark Forums Read


ARCHIVES - Tips, Tricks & Tweaks Tips and Solutions for SUSE Linux
(Please do not post questions here)

 
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 22-Aug-2007, 18:38
Snakedriver
Guest
 
Posts: n/a
Default

As earlier promised here is a howto for making a 4GB Flash Drive with multiple bootable Linux OSes using Grub. Why did I do this, you ask? For one, it makes a handy tool that you can easily carry with you and boot most anything. However, I think the future holds promise for more and more use of flash drives. This is me just getting to know them.

In part1: http://www.suseforums.net/index.php?showtopic=38117; I describe how to make a 4GB Flash Drive with multiple bootable Linux OSes using Grub from a Sidux-lite install,i.e., Grub boot direct technique.

In Part2: http://www.suseforums.net/index.php?showtopic=38377; I described how to do the same using only a basic Grub Partition.

In Part3: http://www.suseforums.net/index.php?showtopic=38378; I described how to add the SystemRescue CD to my Grub partition bootable Flash Drive, i.e., Grub boot Syslinux technique.


Why Grub? Well, I Happen think Grub will boot anything! See: http://www.justlinux.com/forum/showthread.php?t=147959 post #3 (and save me a lot of explaining). Here's thanking Saikee for that excellent howto.

Let's cut to the chase. Here's the setup:

From "fdisk -l" 4GB Corsair Flash Drive
Code:
Disk /dev/sdg: 4118 MB, 4118282240 bytes
255 heads, 63 sectors/track, 500 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

** Device Boot******Start******** End******Blocks** Id**System
/dev/sdg1************** 1**********90******722893+**83**Linux
/dev/sdg2**************91******** 281**** 1534207+**83**Linux
/dev/sdg3************ 282******** 377******771120****b**W95 FAT32
/dev/sdg4************ 378******** 500******987997+** 5**Extended
/dev/sdg5************ 378******** 392******120456** 83**Linux
/dev/sdg6************ 393******** 483******730926** 83**Linux
/dev/sdg7************ 484******** 500******136521****6**FAT16
and the distros look like this:
Code:
/dev/sdg1******BackTrack2**@ 706MB**<-- frugal install
/dev/sdg2******Sidux64-2007-03.1-lite @ 1.46GB**<--full install; My working Grub is here
/dev/sdg3******Knoppix-5.1.1 @ 753MB**<-- frugal install
/dev/sdg4 <--**Extended
/dev/sdg5******NimblexV2 sub-100 @ 118MB**<-- frugal install
/dev/sdg6******Slax6rc6m @ 714MB**<-- frugal install
/dev/sdg7 <--**Fat16 for storage @ 133MB (or for a windows package)
************
Note: There is one mistake ( and I will fix it later) if you ever want windows to see the Flash Drive
The Fat16 partition should be 1st because:
"The use of Fat16 is deliberate because with such a filing system a Dos cannot address hard disk beyond 2Gb" from the link above.
************

And a few more explanatory notes:

1. Each distro has a cushion of 10 to 25 MB; Sidux64 has more.

2. I could have had a Grub partition vice a Sidux Grub; however, as I wanted Sidux64, I chose to do a full install & use that Grub.
An excellent Grub partition howto is @ http://www.linuxquestions.org/questions/sh...ad.php?t=553498 Post #4 should you wish to go that route. Again many thanks to Saikee for that howto also.

3. What's a frugal install? Well, you download the LiveCD distro iso of your choice; burn the image to CD; copy the contents of the CD to a partition on the flash drive; then edit the Grub menu.lst; Ta Da!!! In other words, it will act just like a LiveCD.

4. I did the Flash Drive partitioning with Parted Magic-1.8 LiveCD.

5. You will note that there is no /swap. I read that a Flash Drive has limited writes; and, a swap partition will wear it out very quickly.


So what is the secret? None really. We just have to learn how to read the LiveCD's boot method & translate that to Grub lingo. Here goes:

Let's start with the Knoppix distro as most everyone familiar with LiveCDs knows Knoppix;

Put the newly made Knoppix LiveCD in the CD drive and navigate to /boot/isolinux/isolinux.cfg. One of the many listing will read:
Code:
Knoppix /boot/isolinux/isolinux.cfg
LABEL knoppix
KERNEL linux
APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 initrd=minirt.gz nomce loglevel=0 quiet BOOT_IMAGE=knoppix
All we need to do is edit that entry and put it into a Grub format as follows:
Code:
title********** Knoppix-5.1.1
root************(hd0,2)
kernel**********/boot/isolinux/linux ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 initrd=minirt.gz nomce quite BOOT_IMAGE=knoppix**<-- all on one line
initrd**********/boot/isolinux/minirt.gz
Then using your Linux OS (SuSE or Sidux64 in my case), open Kate in root (use the run command > Put into run Dialog > Options > Run as a different user > root & password; navigate to the active Grub's menu.lst and add that section.

OK, so why did I use "root (hd0,2)". When the computer boots the Flash Drive it will be the 1st drive, hence hd0 and its the 3rd partition, hence hd0,2 (remembering that Grub starts counting @ 0 (zero) for both.

Here are the other distros' sections:
Code:
Nimblex 5/boot/grub/menu.lst
title NimbleX 2007 - Boot in KDE
****root (cd)
****kernel /boot/vmlinuz max_loop=255 init=linuxrc load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=7120 root=/dev/ram0 rw vga=791 splash=silent quiet changes=nimblex.data autoexec=xconf;kdm
****initrd /boot/initrd.gz

edit to:

title********** NimbleX 2007 sub 100 - Boot in KDE
root************(hd0,4)
kernel**********/boot/vmlinuz max_loop=255 init=linuxrc load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=7120 root=/dev/ram0 rw vga=791 splash=silent quiet changes=nimblex.data autoexec=xconf;kdm
initrd**********/boot/initrd.gz
Code:
Backtrack2 /boot/isolinux/isolinux.cfg
label bt
kernel /boot/vmlinuz
append vga=0x317 max_loop=255 initrd=/boot/initrd.gz init=linuxrc load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=4444 root=/dev/ram0 rw

edit to:

title********** Backtrack 2 Beta Live CD
root************(hd0,0)
kernel**********/boot/vmlinuz root=/dev/ram0 rw initrd=/boot/initrd.gz vga=0x317 nodhcp init=linuxrc load_ramdisk=1 prompt_ramdisk=0 max_loop=255 ramdisk_size=100000
initrd**********/boot/initrd.gz
Code:
Slax6rc6 /boot/isolinux/isolinux.cfg
LABEL xconf
MENU LABEL Slax Graphics mode (KDE)
KERNEL /boot/vmlinuz
APPEND vga=769 initrd=/boot/initrd.gz ramdisk_size=6666 root=/dev/ram0 rw autoexec=xconf;kdm

edit to:

title********** Slax6rc6m Graphics mode (KDE) xconf
root************(hd0,5)
kernel**********/boot/vmlinuz vga=769 initrd=/boot/initrd.gz ramdisk_size=6666 root=/dev/ram0 rw autoexec=xconf;kdm
initrd**********/boot/initrd.gz
Lastly, I have a Fat16 partition to use for persistant changes and you will need to go to the various distro home pages and look at the documentation to invoke the persistant changes like saving your wireless config.

Finally, I am sure I missed something; I will come back and edit the howto later when I'm fresh. Feel free to add to the howto; point out my mistakes and ask questions. That's how we all learn, including me.

Have fun...

*******EDIT*****Had a request for a step-by-step for the guide

1st most all of the LiveCD distros can be placed on a Flash Drive; just see the distro's documentation for their guide. It's generally very easy to make a 1GB Flash of all the LiveCD distros.

Note: Always use “Safely Remove” when removing the flash drive from the computer (My Computer > Right click the drive > Safely Remove).

Assuming that your computer will boot a flash drive; it will either boot using a usb-HDD or a usb-ZIP technique. This information will be found in the BIOS and the OEM documentation of your computer (sorry, you will have to look this up for your particular box). Both my laptop and my desktop use the usb-HDD technique; so, that's how this howto is written. Again, for usb-ZIP, you will have to do some searching – sorry. The bottom line is: when you are ready to to boot the Flash Drive, you will have to enter the BIOS and set the Flash Drive (usb-HDD) as the 1st boot device – mine is found under HDD (when expanded).

Step-By-Step

I.
1.1st do “fdisk -l” and find out the exact device of your Flash Drive. With one PATA HDD, it should come up as /dev/sda. Write this down as we don't want to mess over the HDD. On my desktop with all my SATA drives, it came up /dev/sdg. Be sure to do this or you will surely farkle up the HDD.
2.Now we know which drive/evice we are using.

II.
1.Calculate the required size of the needed partition, A LiveCD makes this easy, add 10 to 25 MB as a cushion.
2.Partition and format the 1st two partitions of the drive
3.Make the 1st partition Fat16 (for win read & saving changes)
4.Make the 2nd partition ext2, ext3, fat32, etc,. depending on the requirement of the distro (look it up) if you use a distro for your Grub install. OR
5.Look at the 1st link above if you want a Grub partition install
6.I did mine with Parted Magic 1.8 LiveCD.
7.We will do the rest of the distros later; we want to get Grub working (booting) before we press on.
III.
1.I booted the Sidux64-lite LiveCD & did a full install (1.31GB) to /dev/sda2.
2.I chose to have Grub written to the partition, as I had read that Flash Drives and Grub have trouble if written to the MBR. Worked for me!
3.The install wrote Grub and added all my OS partitions to the Sidux64 Grub menu.lst.

IV
1.Test! Set the BIOS to boot the Flash Drive (as above) and Boot.
2.Assuming that it boots, let's press on.

V Now let's add another distro.
1.Calculate the size of the needed partition +10 to 25 MB cushion
2.Using PM1.8, partition and format /sda3 (see the distro's file system requirement ext2, ext3, fat16, etc.)
3.Copy the contents from the LiveCd to /sda3
4.Close everything
5.Boot into the installed OS
6.Use Kate (or your favorite editor) and edit Grub's menu.lst on /dev/sda2 to reflect the code needed to boot your flash drive's /sda3 distro
7.Save
8.Test, try to boot. If it doesn't boot /sda3, go back and examine that distro's boot section in menu.lst. Generally, Grub will give you some sort of indication where to start looking. see my examples above.
9.Repeat to the other distros
10.Done

Hope this helps; Have fun...
  #2 (permalink)  
Old 22-Aug-2007, 19:05
verxa
Guest
 
Posts: n/a
Default

May I add two comments.

From the post, it is not clear to me where to begin. I have a USB flash drive. What is the first action to create a bootable flash drive?
What is the second? .... The last?

Once the iso images of Knoppix or other CDs are downloaded, there is no need to burn CDs to get the files on them. The images can be mounted with command:

mount -t iso9660 -r -o loop knoppix.iso /mnt; cd /mnt; ls

Don't forget to unmount after use:

cd; umount /mnt
  #3 (permalink)  
Old 22-Aug-2007, 19:32
Snakedriver
Guest
 
Posts: n/a
Default

Quote:
Once the iso images of Knoppix or other CDs are downloaded, there is no need to burn CDs to get the files on them. The images can be mounted with command:

mount -t iso9660 -r -o loop knoppix.iso /mnt; cd /mnt; ls

Don't forget to unmount after use:

cd; umount /mnt
[/b]
True, however, I wanted to boot from the LiveCD anyhow to make sure that I could get my rt2500 or WG511T Madwifi wireless up 1st, prior to selecting those distros for my flash drive experiment; then, I just used them as they were handy. BTW, The iso can also be extracted using Kiso or IsoMaster and copied over. Both of those should be in one's tool kit. I use them extensively sticking modules into all the Slax derived distros.

I'll post a step-by-step later as an edit, when I'm fresh.

  #4 (permalink)  
Old 23-Aug-2007, 08:22
Snakedriver
Guest
 
Posts: n/a
Default

Quote:
May I add two comments.

From the post, it is not clear to me where to begin. I have a USB flash drive. What is the first action to create a bootable flash drive?
What is the second? .... The last?
[/b]
Added as an edit to post #1

Get back if you have problems or questions.

Have fun...
  #5 (permalink)  
Old 23-Aug-2007, 17:59
Wrath5000
Guest
 
Posts: n/a
Default

Thanks a million, Snakedriver!

I've been tinkering around with a bunch of live disks lately--in particular Wolvix and NimbleX, and this guide is exactly what I've been looking for. I can't wait to try it out!
  #6 (permalink)  
Old 26-Aug-2007, 00:48
famewolf
Guest
 
Posts: n/a
Default

Quote:
Added as an edit to post #1

Get back if you have problems or questions.

Have fun...
[/b]

What?!? No downloadable image I can dd if=image of=jumpdrive to boot up into portable suse?

Snakedriver..you are getting so slack..I thought you were gonna do all the hard work.

 

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




 

Search Engine Friendly URLs by vBSEO 3.3.0 RC2