Sunday, February 03, 2013

Making a USB boootable from an ISO file

  • Prepare a bootable USB by using RMPrep with grub4dos.
  • Download an ISO file, e.g. Panda Safe CD ISO, "SafeCD.iso" 
  • Mount that iso so we can view and access all files in that iso.
  • Notice the dir structure in the iso. It should have a file call "isolinux.cfg". Look inside "isolinux.cfg" with text editor, It should mention a file that show up a menu upon starting up the iso. In this example, the file is called "menu.cfg".
  • Look inside "menu.cfg" with text editor. It should show the detail of the menu. Here is:
LABEL live
    MENU LABEL Start SafeDisk
    kernel /live/vmlinuz1
    append initrd=/live/initrd1.img boot=live union=aufs




Here we have to adjust this accordingly to our menu.lst. This can be shown as


title Panda Safe CD
find --set-root /live/initrd1.img
kernel /live/vmlinuz1 boot=live union=aufs
initrd /live/initrd1.img


Notice all necessary files are in one directory. Here is directory called "live". Copy the whole "live" directory to our USB. Then put a new created menu.lst into the root of our USB.

Wednesday, January 16, 2013

Booting USB from Virtual Box

VirtualBox can be set to accept booting from USB. This is purposed to test the recovery USB stick. Instead of booting from the real machine, you can boot the USB recovery stick from the virtual machine so it is easier to fix the USB. This is very useful for making a booting USB like in my earlier post, "Multiboot USB with 15 instances".

There are 2 methods to boot the USB in virtualbox. First, we can use PloP as an ISO image to attach to the CD ROM drive of any OS in the virtualbox. Then we add our real USB in the USB setting of Virtualbox. (Don't check Enable USB2 box because PloP doesn't support it.) When used, this USB will be seen by the Virtualbox OS only. This method can be used with any bootable USB. The problem is that it is very slow to boot an OS in the USB because PloP allows connecting with USB1 only.

The second method is creating virtual USB device from the real USB with this command:

VBoxManage internalcommands createrawvmdk -filename "%USERPROFILE%"\.VirtualBox\usb.vmdk -rawdisk \\.\PhysicalDrive#

where # is the USB disk number (looked in Windows Disk Management.). The virtual USB is usb.vmdk file. This can be added in Virtualbox as an existing hard drive.

Don't add our real USB in the Virtualbox USB setting as the USB needs to be seen from the host windows.

Note that this virtual USB will use with the USB that you created with only. The order of plugging the USB is also important. This has to be the order to make the USB the right PhysicalDrive number. It means if you fail to do this, i.e. changing from 8G to 4G or plugging the USB the wrong order, the system won't boot. Therefore, it is a good idea to name this Virtualbox OS to be something meaningful like "Virtual USB 8G Disk2". The advantage of this method is that the USB speed is much faster than the first one. This is the method of my choice.

Last but not least, you need to set Virtualbox base memory and video memory to some extent; otherwise, some OS won't boot up. I am using 2048M for the base memory, and 32M for the video memory.