Dualboot Linux and Android-x86 on a USB2 Flash Drive
|| Krister's Blog |
krister at hallergard dot com
Here I prepare a USB2-stick to enable dualbooting of Linux and Android partitions, with the help of the
Ranish Partition Manager.
These partitions are proper installations, not just ISO-files! In this way it is possible to multi-boot from a
USB-stick with up to four primary partitions. However, I have not (yet) managed to boot a DOS or Windows partition using
Ranish on a USB-stick - even though this is easily accomplished on a normal hard disk drive.
View Video 4½ min
Here I use a 16GB SanDisk (Cruzer Blade) USB-stick. On the right there is the Ranish Partition Manager after final edit,
with two partitions of roughly 8 GB each and a small space for the advanced boot manager (the Ranish compact boot manager
resides in the Master Boot Record - MBR). To the right there is also the Ranish
Boot Menu as it appears at startup after leaving BIOS. The USB-stick Disk3, partition 1, is highlighted for boot.
The file system ext2 is indicated, though Ranish uses this also for ext3 and ext4. I use ext3 as I frequently use
PartImage for backup and restore of entire Linux partitions, and Partimage
cannot handle the ext4 or btfrs file systems.
Ranish Partition Manager
Ranish Boot Menu
I formatted the partitions with file system ext3, which might not be necessary. The partitions are now ready for installation,
just like any partition on any hard disk drive. Here I choose instead to restore two other USB disk images created with Partimage.
To do this I booted Linux Kubuntu on my Desktop (third partition of the first disk).
Restoring to /dev/sdc1
Restoring to /dev/sdc2
Make /dev/sdc2 bootable
On the first partition of the USB-stick I cloned a 4GB USB-stick containing a Kubuntu 14.04 (32-bit) installation.
I found that 4GB was very much too cramped (yes, am aware that there are Linux distros happy with very much less space),
but here I am moving it onto an almost 8GB partition. Later it needs to be resized from 4GB to the
available almost 8GB (and in this case the formatting might have been beneficial for the last 4GB, which still would
have had the FAT32 format).
This Linux partition already has the bootloader Grub2 installed, but to make it bootable, the Grub2 bootsector
has to be installed, using this command in a Linux terminal:
sudo grub-install --root-directory=/mnt/sdc1 /dev/sdc1
After booting the USB-stick on a new host, it might be advisable too "update-grub". On the next reboot of the
USB-stick, any host partition could be booted from the stick's Grub2 boot menu.
This Android-x86 partition already has the bootloader Grub1 installed, but to make it bootable the Grub bootsector
has to be installed. This is done by rebooting and entering a Grub1 menu - which my PC has on
drive 1 partition 1 - the Linux Suse boot menu.
When at the Grub1 menu tap "Esc" and "Enter" for OK to exit the graphical
interface and tap "C" to exit to a command line with the grub> prompt. The commands are shown to the left: (remember
that Grub1 starts counting disks and partitions from 0 - not 1 as Grub2)