Hello world, in this instructable I will be showing you how to use the Multisystem program on a partition other than the first one. Multisystem only seems to find the first partition, so this guide will allow you to use Multisystem on any other partition that is FAT32.
The dilema: I need to put a small multi-boot partition on a flash drive and have the rest of the space be partitioned as NTFS so that all of the major operating systems can read/write it. Unfortunately, Windows doesn't like to play along and it does not acknowledge the presence of any partitions other than the first on a flash drive (works OK on an HDD). The solution is to have the first partition be NTFS and the second partition be FAT32, but Multisystem does not acknowledge any partition other than the first to install the bootable files.
The solution: modify Multisystem to install the boot files on the second partition. This way Windows will be able to see the main NTFS partition and Linux/OS X will be able to detect both partitions like usual.
In the next step I will be talking about how I figured out how to modify Multisystem. If you just want to do this already, then skip to the step after the next.
This instructable will assume that you have experience working on Ubuntu Linux along with some idea of how partitions and stuff works in the practical world.
When working with partitions and data in the way that this instructable will show, THERE IS ALWAYS THE POSSIBILITY OF LOSING YOUR DATA OR ACCIDENTALLY DOING THESE OPERATIONS ON THE WRONG DATA STORAGE DEVICE.
I cannot stress the importance of backups and making sure you are verifying that the actions you take are correct in order to minimize the possibility of losing your data.
That said, whatever happens, I am in no way responsible if something goes wrong. Tread cautiously and try to be smart.
Step 1: How Was Multisystem Modified?
This step is for those interested in knowing how I knew what to modify in the Multisystem program. If you just want to get started already, proceed to the next step.
I actually thought about modifying Multisystem to detect more than first partitions if I couldn't get any other tricks to work. Of course, I was at work and didn't have the time to reverse engineer the program. When I went home, I got to work (and missed all 3 Star Trek episodes on TV).
The first step was to get my hands on the source code. This was a little challenging because the Multisystem web page is in French. Eventually I found the download page and it had a link to the source code for those Linux people who prefer to compile things themselves. I downloaded the package and extracted it.
I expected the code to be in C or C++ because many programs for Linux are written in those languages. I was surprised to find that the whole program seems to have been written in Bash.
I read the instructions to the source code which said that to run Multisystem from source, all you have to do is run the command bash gui_multisystem.sh.
Since this was the "patient zero" file, I decided to look in there to see if I could find the code that was involved with finding the partitions of a storage device that was formatted in FAT32.
I couldn't find the code in that file, but I did find a file that was referenced in the /tmp directory and based on the name it seemed to hold the information on the partitions that would show up in the selection menu.
I used the grep tool to search all the Multisystem source code files for lines that had the name of the file in them. I got a few results. Some of them were from the "patient zero" file, others were from a file called gtkdialog-function1.sh, and others were from files that didn't seem important.
I checked through the "patient zero" file first, but it seemed like it only read from that file, not write to it. I then checked the gtkdialog-function1.sh file and that seemed to be where the partitions were found and written to the file.
I added some debug echos to the file to see if my second partition was found. It was, but it seemed like execution stopped before it would write that second partition's info the file. This turned out to be from an if statement that only allowed the partition to pass through if it was the first partition.
At this point the solution was easy, change the 1 to a 2, and this worked! The partition showed up in the selection menu.
It's worth noting that it probably would have been better to remove the if statement than change it to a 2 because now it won't find anything other than the 2nd partition. Without the if statement it will allow any partition to pass through as long as it matches the other conditions. But I was lazy and it was late at night, so for now changing it to 2 would have been easier than finding the fi statment that belonged to the if statement.
Step 2: Partitioning Your Flash Drive
If you want to make your flash drive so that the main NTFS (or whatever) partition is visible from Windows, then you have to partition your flash drive with the main partition first, and the boot partition second (boot partition won't be seen in Windows because it isn't first).
To do this, we will be using GParted on Ubuntu Linux. A simple "sudo apt-get install gparted" should take care of the installation on Ubuntu.
Insert your flash drive into your computer and open up GParted. Then select your device with the top-right drive selection drop-down box. TAKE CARE TO SELECT THE CORRECT ONE otherwise you might do the following operations to your primary hard drive.
You want to right click each partition and unmount them. (pic 1)
Then right click each partition and delete it. YOU WILL LOSE ALL THE DATA ON THE PARTITIONS. (pic 2)
Right click the single unallocated partition that's left and click New. (pic 3)
The first partition you want to make is the main NTFS one. Select ntfs in the "File system" drop-down box. (pic 4) Then add 4096 MB (4 gigs or whatever) of free following the end of the partition, the "New size" input should automatically change its value to reflect the size of the drive minus the 4096 megabytes. (pic 5) Give it a label if you want and click Add.
Then right click the second 4 GB unallocated partition and click New. (pic 6) You want to format it as fat32 in the "File system" drop-down. Then make sure the "New size" input says 4096 (or whatever free space you left for the boot partition). (pic 7) Then click Add.
Then click the Apply checkbox near the center of the top. (pic 8)
When it finished formatting and partitioning, I recommend unplugging and replugging your flash drive once to make sure that your computer can actually see both partitions.
Congratulations, your flash drive has been partitioned.
Step 3: Getting the Source Code
Now that the flash drive is partitioned, we need to get the source code that we will modify to do our bidding.
In your browser, go to the Multisystem web page http://liveusb.info/dotclear. (pic 1)
Then scroll to roughly the middle and click "Installation" from the right side menu. (pic 2)
Then scroll down to "Méthode N° 3" and click the "Téléchargement" link to download the compressed version of the source code. (pic 3)
Alternatively, click here to download the compressed source code: http://liveusb.info/multisystem/multisystem.tar.bz2
Once it has downloaded, you want to open up the compressed source code with Ubuntu Archive Manager (or use the command line if you have those uber haxor skills) and extract the multisystem folder to your desktop (or other work area). (pic 4) (pic 5)
Step 4: Modifying Multisystem
Now that we have our source code, it's time to actually modify the program.
Open up the multisystem folder that you extracted from the compressed download.
Find the gtkdialog-function1.sh file and open it with your favorite text editor (in my case gedit with the cobalt theme). (pic 1)
Go to around line 100 (it was 100 at the time of writing) and find where it's comparing the partition number to 1. (pic 2)
Change the 1 to a 2. (pic 3)
That should be it, onward to use the program.
Step 5: Running Multisystem
Now that the modification is done, we can run Multisystem.
Open a terminal in the multisystem folder and type bash gui_multisystem.sh. (pic 1)
The Multisystem window should show up with your second partition showing (assuming your flash drive is still plugged in). (pic 2)
At this point I get errors in the console when I click Confirm. It seems that closing Multisystem after getting errors and opening it back up fixes the problem (might be because I've done this before and it's cached data or something).
When you click Confirm, you should see a message like "device:/dev/sdx2" in the console. (pic 3) This means that it's working and Multisystem will apply changes to the 2nd partition.
Multisystem will most likely give you a message saying that it added the MULTISYSTEM label to your partition. This can be checked with GParted. (pic 4)
Just follow the instructions that Multisystem gives you to set up your flash drive for the first time (before you add a live OS to it).
Step 6: Adding Your OS
This part is pretty simple.
Use Multisystem to add your OS iso files to the flash drive, you'll figure how.
Make sure that it is actually applying to the partition you want it to. (pic 1)
Step 7: "Post Processing"
Once you have added your iso files to the partition with Multisystem, you'll have to use GParted to modify the boot flags.
Open GParted and select your storage device. You'll see that your main NTFS partition has the boot flag on it. (pic 1) This is incorrect, it should be the second partition with the boot flag since that is the one that will be used to boot off of. There is probably something in the source code that can be modified to fix this, but at the time it was faster to manually set the boot flags than to trace the source code to find what needs to be modified for that.
Change it by right clicking your main partition and clicking Manage Flags. (pic 2) Unselect the boot option in the window that pops up.
Add the boot flag to your booting partition by right clicking the MULTISYSTEM partition and clicking Manage Flags. Then select the boot option from the pop up.
You should be done at this point.
One thing to keep in mind is that if the boot flag is added to the wrong partition, then it might be added to the wrong partition each time you add/remove an iso from your bootable partition. The solution if this is true is to do this step each time you make a change with Multisystem.
Step 8: Testing It Out
At this point, you want to make sure that everything works as it should.
The first test is to see if the flash drive can actually boot into your live OS. I tried this on my computer and I got the Multisystem OS selection program. (pic 1) Then I was able to boot it into an Ubuntu live session. (pic 2) This is a success for test 1.
The second test is to see if Windows can recognize the main data partition. I booted into Windows and plugged my flash drive in. (pic 3) This was also a success. I was able to access my files from the main NTFS partition. (pic 4)
In theory OS X (or Mac OS as it's called now) should be able to see both partitions like Ubuntu does, but Windows can only see the first partition on a flash drive (which is why we put the bootable partition second).
If all worked out, congratulations!
Otherwise try to fix the problem if you can and post it in the comments for the world to know.