Boot multiple ISO files on single USB flash drive using GRUB2 with and without persistence.

I used ubuntu-11.04-desktop-amd64.iso to create this.
"sudo su" at beginning so I don't need sudo on every command.
If you use something else, you may also need apt-cache show grub-pc

See Below for grub.cfg example, edit to taste, remove unused items.


Notes adapted from:
http://www.pendrivelinux.com/boot-multiple-iso-from-usb-via-grub2-using-linux/

http://www.paranoids.at/?page=grub2stick

http://www.pendrivelinux.com/how-to-create-a-larger-casper-rw-loop-file/

DO NOT DIRECTLY CUT AND PASTE THESE INTO YOUR SYSTEM!!
YOU MUST EDIT TO YOUR NEEDS OR YOU MAY DESTROY YOUR DATA!

I do not want to wipe the existing data on the drive, just add linux to it:
so first check where the PC mounted it using df -kh, mount and fdisk -l

Remount without sync if needed, then

grub-install --force --no-floppy --root-directory=/media/XXXXX /dev/sdX
Mark your device bootable with:
fdisk /dev/sdX

Copy your ISO files into place, I recommend /boot/iso/

Create empty 3 gig file full of zeros for persistence
dd if=/dev/zero of=/isodevice/casper-rw bs=3G count=1

format the file
mkfs.ext3 -F /isodevice/casper-rw




wget pendrivelinux.com/downloads/multibootlinux/grub.cfg -o /isodevice/boot/grub/grub.cfg
vi /isodevice/boot/grub/grub.cfg

set timeout=5
set default=0

menuentry "linuxmint-14-xfce-dvd-64bit.iso" {
 loopback loop /boot/iso/linuxmint-14-xfce-dvd-64bit.iso
 linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/boot/iso/linuxmint-14-xfce-dvd-64bit.iso noeject noprompt splash --
 initrd (loop)/casper/initrd.lz
}

menuentry "ubuntu-12.04.1-desktop-amd64.iso" {
 loopback loop /boot/iso/ubuntu-12.04.1-desktop-amd64.iso
 linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/boot/iso/ubuntu-12.04.1-desktop-amd64.iso noeject noprompt splash --
 initrd (loop)/casper/initrd.lz
}

menuentry "KNOPPIX_V7.0.4DVD-2012-08-20-EN.iso" {
 loopback loop /KNOPPIX_V7.0.4DVD-2012-08-20-EN.iso
 linux (loop)/boot/isolinux/linux knoppix bootfrom=KNOPPIX_V7.0.4DVD-2012-08-20-EN.iso ramdisk_size=100000 lang=en vt.default_utf8=0 apm=power-off initrd=minirt.gz nomce libata.force=noncq hpsa.hpsa_allow_any=1 loglevel=1 tz=localtime
 initrd (loop)/boot/isolinux/minirt.gz
}

menuentry "ubuntu-12.04-desktop-amd64.iso" {
 loopback loop /boot/iso/ubuntu-12.04-desktop-amd64.iso
 linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/boot/iso/ubuntu-12.04-desktop-amd64.iso noeject noprompt splash --
 initrd (loop)/casper/initrd.lz
}

menuentry "Memtest 86+ V4.20" {
 linux16 /boot/iso/memtest86pV420.bin
}

menuentry "persistent rw ubuntu-12.04-desktop-amd64.iso" {
 loopback loop /boot/iso/ubuntu-12.04-desktop-amd64.iso
 linux (loop)/casper/vmlinuz boot=casper persistent rw iso-scan/filename=/boot/iso/ubuntu-12.04-desktop-amd64.iso noeject noprompt splash --
 initrd (loop)/casper/initrd.lz
}

menuentry "ubuntu-12.04-desktop-i386.iso" {
 loopback loop /boot/iso/ubuntu-12.04-desktop-i386.iso
 linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/boot/iso/ubuntu-12.04-desktop-i386.iso noeject noprompt splash --
 initrd (loop)/casper/initrd.lz
}

menuentry "persistent rw ubuntu-11.04-desktop-amd64.iso" {
 loopback loop /boot/iso/ubuntu-11.04-desktop-amd64.iso
 linux (loop)/casper/vmlinuz boot=casper persistent rw iso-scan/filename=/boot/iso/ubuntu-11.04-desktop-amd64.iso noeject noprompt splash --
 initrd (loop)/casper/initrd.lz
}

menuentry "KNOPPIX_V6.7.1DVD-2011-09-14-EN.iso" {
 loopback loop /KNOPPIX_V6.7.1DVD-2011-09-14-EN.iso
 linux (loop)/boot/isolinux/linux knoppix bootfrom=KNOPPIX_V6.7.1DVD-2011-09-14-EN.iso ramdisk_size=100000 lang=en vt.default_utf8=0 apm=power-off initrd=minirt.gz nomce libata.force=noncq hpsa.hpsa_allow_any=1 loglevel=1 tz=localtime
 initrd (loop)/boot/isolinux/minirt.gz
}

menuentry "text only g7-1219wm KNOPPIX_V6.7.1DVD-2011-09-14-EN.iso" {
 loopback loop /KNOPPIX_V6.7.1DVD-2011-09-14-EN.iso
 linux (loop)/boot/isolinux/linux knoppix 2 nomodeset bootfrom=KNOPPIX_V6.7.1DVD-2011-09-14-EN.iso ramdisk_size=100000 lang=en vt.default_utf8=0 apm=power-off initrd=minirt.gz nomce libata.force=noncq hpsa.hpsa_allow_any=1 loglevel=1 tz=localtime
 initrd (loop)/boot/isolinux/minirt.gz
}

menuentry "ubuntu-11.10-alternate-amd64.iso" {
 loopback loop /boot/iso/ubuntu-11.10-alternate-amd64.iso
 linux (loop)/linux --
 initrd (loop)/initrd.gz
}

menuentry "ubuntu-11.04-desktop-amd64.iso" {
 loopback loop /boot/iso/ubuntu-11.04-desktop-amd64.iso
 linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/boot/iso/ubuntu-11.04-desktop-amd64.iso noeject noprompt splash --
 initrd (loop)/casper/initrd.lz
}

menuentry "ubuntu-11.04-desktop-i386.iso" {
 loopback loop /boot/iso/ubuntu-11.04-desktop-i386.iso
 linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/boot/iso/ubuntu-11.04-desktop-i386.iso noeject noprompt splash --
 initrd (loop)/casper/initrd.lz
}

menuentry "linuxmint-10-gnome-dvd-amd64.iso" {
 loopback loop /boot/iso/linuxmint-10-gnome-dvd-amd64.iso
 linux (loop)/casper/vmlinuz file=/cdrom/preseed/mint.seed boot=casper initrd=/casper/initrd.lz iso-scan/filename=/boot/iso/linuxmint-10-gnome-dvd-amd64.iso noeject noprompt splash --
 initrd (loop)/casper/initrd.lz
}

menuentry "kiwi-10.08.iso" {
 loopback loop /boot/iso/kiwi-10.08.iso
 linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/boot/iso/kiwi-10.08.iso noeject noprompt splash --
 initrd (loop)/casper/initrd.lz
}

menuentry "KNOPPIX_V6.7.1DVD-2011-09-14-EN.iso" {
 loopback loop /KNOPPIX_V6.7.1DVD-2011-09-14-EN.iso
 linux (loop)/boot/isolinux/linux knoppix bootfrom=KNOPPIX_V6.7.1DVD-2011-09-14-EN.iso ramdisk_size=100000 lang=en vt.default_utf8=0 apm=power-off initrd=minirt.gz nomce libata.force=noncq hpsa.hpsa_allow_any=1 loglevel=1 tz=localtime
 initrd (loop)/boot/isolinux/minirt.gz
}

menuentry "linuxmint-11-gnome-dvd-64bit.iso" {
 loopback loop /boot/iso/linuxmint-11-gnome-dvd-64bit.iso
 linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/boot/iso/linuxmint-11-gnome-dvd-64bit.iso noeject noprompt splash --
 initrd (loop)/casper/initrd.lz
}









Once you are rebooted with the shiney new persistance file working:
df -kh

Run Synaptic package manager or your favorite, way to update sources etc.

vi /etc/apt/sources.list
deb cdrom:[Ubuntu 11.04 _Natty Narwhal_ - Release amd64 (20110427.1)]/ natty main restricted
deb http://mirrors.us.kernel.org/ubuntu/ natty main restricted universe multiverse
deb-src http://mirrors.us.kernel.org/ubuntu/ natty main restricted universe multiverse
deb http://mirrors.us.kernel.org/ubuntu/ natty-security main restricted universe multiverse
deb-src http://mirrors.us.kernel.org/ubuntu/ natty-security main restricted universe multiverse
deb http://mirrors.us.kernel.org/ubuntu/ natty-updates main restricted universe multiverse
deb-src http://mirrors.us.kernel.org/ubuntu/ natty-updates main restricted universe multiverse
# Google testing repository
deb http://dl.google.com/linux/deb/ testing non-free
 
Import the google key files so you can use Picasa from google:
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -

Now install all your favorite packages:
apt-get update
apt-get upgrade
apt-get install mc aptitude sipcalc vim ssh moc chromium-browser wine flashplugin-installer picasa vlc mozilla-plugin-vlc



If you like to use proprietary CODEC to play streaming video, audio, MP3, mpeg1, mpeg2, mpeg4, avi, wmv, wma, etc. 
https://help.ubuntu.com/community/RestrictedFormats
http://www.stchman.com/codecs.html
# apt-get -y install gstreamer0.10-ffmpeg gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse

Fix your time zone:
# dpkg-reconfigure tzdata

If you run Windows and do not like the clock wrong later:
vi /etc/default/rcS
Change UTC=yes to UTC=no

Clear the ubuntu package cache to save space on your small flash drive
# apt-get clean







http://www.google.com/support/forum/p/Picasa/thread?tid=7a8ec009325ff854&hl=en
http://www.google.com/support/forum/p/Picasa/thread?tid=77c38e02f35c8fcb&hl=en
http://www.google.com/support/forum/p/Picasa/thread?tid=06e0d1b3fa165d81&hl=en
http://www.google.com/support/forum/p/Picasa/thread?tid=6509b77271b16cdf&hl=en


I transfered from vista down to XP by simply copying the db3 folder.  I did not use the backup feature in picasa at all because all my photos were on a network share, and already accessible to both computers.  

Picasa db storage:
Win XP: C:\Documents and Settings\YourUserNameHere\Local Settings\Application Data\Google\Picasa2\db3
Win Vista: C:\Users\YourUserNameHere\AppData\Local\Google\Picasa2\db3

Win 7: 
C:\Users\g\AppData\Local\Google\Picasa2\db3
C:\Users\g\AppData\Local\Google\Picasa2\contacts






I have not tested but upgrading to picasa 3.8 may work per:
http://www.webupd8.org/2010/04/how-to-install-picasa-36-in-ubuntu.html
cd /home/ubuntu/Desktop
wget http://dl.google.com/picasa/picasa38-setup.exe
double click the picasa38-setup.exe file on your desktop and install Picasa 3.8 with the default settings

Now all we have to do is copy the Picasa 3.8 files over 3.0 using the following command:
sudo cp -r ~/.wine/drive_c/Program\ Files/Google/Picasa3/* /opt/google/picasa/3.0/wine/drive_c/Program\ Files/Google/Picasa3/

Now run Picasa 3.8 from Applications > Graphics > Picasa > Picasa.
Important note: Don't click the "Places" button as it will freeze Picasa 3.8 and it will fail to start again!




3 comments:

Roonaldo said...

Hi, i followed your instructions and it worked but i find it to be very slow compared to without persistence. Is that to be expected and is there anything i can do?

Thanks

Gavin said...

Yes that is expected. Quite a bit of wrapping and merging of of file systems going on here.

Gavin said...

For regular daily use, do a standard install of your favorite Linux distribution. Linux will work better if it does not need to deal with windows, FAT or NTFS partitions. This guide is useful for keeping your flash disk usable in cases where you are forced to use windows and do not have the permission to install software for windows to read other file system types. Naturally with all things windows related, it is inefficient and slow.