27 August 2010

Creating a multi-partition usb drive with dual booting persistent Linux Mint and Puppy Linux

Wow, that title is really a mouth full :)

First off, i used other guides while doing this, and i would not have made it without them.
* http://tazbuntu.blogspot.com/2009/05/multibootin-with-unetbootin.html For getting the multibooting to work

So, i wanted a bootable usb-stick. I wanted Linux Mint, for obvious reasons, and also Puppy Linux, if i ever were to come across a old and crappy computer. To be extra picky, i also wanted the OS to be on a separate partition, since it looks messy with loads of weird linux-files in the root. I also wanted to be able to use the data-part of the stick in both windows and linux.

So, to put in in a list form:

* Boot Mint and Puppy
* Separate OS and data partitions
* Work in both Windows and Linux

Ok, so the first thing i discovered was that Windows for some weird reason will only read the first partition on a usb-stick..

1. Start Linux. I used Linux Mint 9. Whether you have it installed by default or use a live-cd doesnt matter.

2. Install programs needed. Gparted for partitioning, unetbootin for the puppy part.
sudo apt-get install gparted unetbootin

3. Partition your usb-stick.

- Start gparted.

- Remove all partitions on your usb-stick (this WILL delete everything you the usb-stick, so take care while doing it, and make sure it is your usb-stick you are deleting)

- Create the data partition that will work in both linux and windows. I used 12gb for this on my 16gb stick. Make the file system NTFS so that windows can read it. It is IMPORTANT to create this first in the beginning of the usb-stick, since windows only reads the first partition.

- Create the OS partition that will host your linux installs. Make this FAT32. (maybe ext will work?)

- Perform the changes with gparted if you have not already done so.

4. Download the latest Linux Mint and Puppy Linux isos. (just google it)

5. Use unetbootin to install Puppy Linux on the OS partition you just created.

6. Copy the entire OS partition to a folder called /puppy on the data-partition. This is just for storing it until later.

7. Format the OS partition to clear away puppy linux. Make sure it is still FAT32.

8. Use the "Startup Disc Creator" that is included in all later Ubuntu editions. It is for sure included in Linux Mint 9. Use it to install the linux mint iso you downloaded in step 4 onto the newly formated OS partition. Select a nice size for the "reserved extra space". I used 1 gb for this. This is where the persistence comes in. All changes you make will be saved in this space, so dont be cheap ;)

Ok, so now there is a data partition that works in windows, a persistent linux mint on it, and soon there will be puppy as well!

9. Copy the files from the /puppy folder from the data partition and place it in /puppy on the OS partition.

10. Edit /syslinux/syslinux.cfg on the OS partition. This is the grub menu that is displayed during boot. Puppy linux has to be inserted here to be able to choose it.

My file looked like this:

default vesamenu.c32
timeout 100

menu background splash.jpg
menu title Welcome to Linux Mint 9 Isadora
menu color border 0 #00eeeeee #00000000
menu color sel 7 #ffffffff #33eeeeee
menu color title 0 #ffeeeeee #00000000
menu color tabmsg 0 #ffeeeeee #00000000
menu color unsel 0 #ffeeeeee #00000000
menu color hotsel 0 #ff000000 #ffffffff
menu color hotkey 7 #ffffffff #ff000000
menu color timeout_msg 0 #ffffffff #00000000
menu color timeout 0 #ffffffff #00000000
menu color cmdline 0 #ffffffff #00000000
menu hidden
menu hiddenrow 6
label live
menu label Start Linux Mint
kernel /casper/vmlinuz
append noprompt cdrom-detect/try-usb=true persistent file=/cdrom/preseed/mint.seed boot=casper initrd=/casper/initrd.lz quiet splash --
menu default
label xforcevesa
menu label Start Linux Mint (compatibility mode)
kernel /casper/vmlinuz
append noprompt cdrom-detect/try-usb=true persistent file=/cdrom/preseed/mint.seed boot=casper xforcevesa initrd=/casper/initrd.lz ramdisk_size=1048576 root=/dev/ram rw noapic noapci nosplash irqpoll --
label memtest
menu label Memory Test
kernel memtest
label local
menu label Boot from local drive
localboot 0x80


Almost unreadable, so lets add some blank lines


default vesamenu.c32
timeout 100

menu background splash.jpg
menu title Welcome to Linux Mint 9 Isadora
menu color border 0 #00eeeeee #00000000
menu color sel 7 #ffffffff #33eeeeee
menu color title 0 #ffeeeeee #00000000
menu color tabmsg 0 #ffeeeeee #00000000
menu color unsel 0 #ffeeeeee #00000000
menu color hotsel 0 #ff000000 #ffffffff
menu color hotkey 7 #ffffffff #ff000000
menu color timeout_msg 0 #ffffffff #00000000
menu color timeout 0 #ffffffff #00000000
menu color cmdline 0 #ffffffff #00000000
menu hidden
menu hiddenrow 6

label live
menu label Start Linux Mint
kernel /casper/vmlinuz
append noprompt cdrom-detect/try-usb=true persistent file=/cdrom/preseed/mint.seed boot=casper initrd=/casper/initrd.lz quiet splash --
menu default

label xforcevesa
menu label Start Linux Mint (compatibility mode)
kernel /casper/vmlinuz
append noprompt cdrom-detect/try-usb=true persistent file=/cdrom/preseed/mint.seed boot=casper xforcevesa initrd=/casper/initrd.lz ramdisk_size=1048576 root=/dev/ram rw noapic noapci nosplash irqpoll --

label memtest
menu label Memory Test
kernel memtest
label local

menu label Boot from local drive
localboot 0x80


Ahh, much better!

Ok, so we have to add Puppy to the list

label puppy
menu label Puppy Linux 5.1.0
kernel /puppy/vmlinuz
append initrd=/puppy/initrd.gz pmedia=cd

should do the trick. And the final result should look like this:


default vesamenu.c32
timeout 100

menu background splash.jpg
menu title Welcome to Linux Mint 9 Isadora
menu color border 0 #00eeeeee #00000000
menu color sel 7 #ffffffff #33eeeeee
menu color title 0 #ffeeeeee #00000000
menu color tabmsg 0 #ffeeeeee #00000000
menu color unsel 0 #ffeeeeee #00000000
menu color hotsel 0 #ff000000 #ffffffff
menu color hotkey 7 #ffffffff #ff000000
menu color timeout_msg 0 #ffffffff #00000000
menu color timeout 0 #ffffffff #00000000
menu color cmdline 0 #ffffffff #00000000
menu hidden
menu hiddenrow 6

label live
menu label Start Linux Mint
kernel /casper/vmlinuz
append noprompt cdrom-detect/try-usb=true persistent file=/cdrom/preseed/mint.seed boot=casper initrd=/casper/initrd.lz quiet splash --
menu default

label xforcevesa
menu label Start Linux Mint (compatibility mode)
kernel /casper/vmlinuz
append noprompt cdrom-detect/try-usb=true persistent file=/cdrom/preseed/mint.seed boot=casper xforcevesa initrd=/casper/initrd.lz ramdisk_size=1048576 root=/dev/ram rw noapic noapci nosplash irqpoll --

label puppy
menu label Puppy Linux 5.1.0
kernel /puppy/vmlinuz
append initrd=/puppy/initrd.gz pmedia=cd

label memtest
menu label Memory Test
kernel memtest
label local

menu label Boot from local drive
localboot 0x80


Ok, now everything should be working. Reboot your computer and start from the usb-stick, and you should be greeted by grub!

A recommendation is to install PortableApps on the data partition from windows. After that, you will have a very functional usb-stick that has all the programs you need (PortableApps) and can even boot it's own OS if needed (Mint or Puppy).