Mounting a USB drive (windows format)

M. Edward (Ed) Borasky znmeb at cesmail.net
Fri Dec 21 22:37:19 EST 2007


Jeffrey Kesselman wrote:
> Hi Guys,
> 
> im trying to get started developign but ist pretty clear that my
> development environment wont fit on the emulation image's disk.
> 
> No biggie,  I figured, I'll put it on a USB memory stick.
> 
> I can tell my emulator (VMWARE) to make the USb memory stick acessible
> to the emulated hardware no problem but I can't figure out how to get
> it to mount in the OLPC.
> 
> Help?  I'm running ship2, if thats any help.
> 
> 
> JK
> 

I've been doing a lot of VMware emulations of various OLPC images on my
Linux box. I have an AMD64 running Gentoo Linux and VMware Workstation
6. This could probably be made to work on Windows but I don't have any
largish Windows systems.

1. Download the image ext3 file. I have a "wget" script that does it.
2. You need to install "qemu". It has a utility to convert a .img to a
.vmdk. Here's the bash script that does it, assuming "qemu" is installed.

#! /bin/bash -v
export
WHERE=http://xs-dev.laptop.org/~cscott/olpc/streams/ship.2/build653/devel
_ext3
export WHAT=olpc-redhat-stream-ship.2-devel_ext3
wget ${WHERE}/${WHAT}.img.bz2
wget ${WHERE}/${WHAT}.img.bz2.md5
md5sum -c ${WHAT}.img.bz2.md5
bunzip2 ${WHAT}.img.bz2
qemu-img convert ${WHAT}.img -O vmdk ${WHAT}.vmdk

3. OK ... now you have a vmdk image. Rather than mess with a USB stick
or anything like that, I just make a bigger virtual disk and copy the
image over to it! Here's what you have to do:

a. Create a virtual machine. Give it 256 MB and a new virtual disk. The
new virtual disk has to be an IDE and *not* the default SCSI. The
drivers are looking for an IDE drive. Then, *add* a hard drive and
select "use existing virtual disk". *That* one is the image you
downloaded and converted to vmdk format.

b. Edit the ".vmx" file from the virtual machine and add the following
line at the bottom:

      bios.forceSetupOnce = "TRUE"

This will make the machine come up in the emulated BIOS the first time
you boot it. Go over to the boot order selection menu and make sure the
CD-ROM boots before the hard drive.

c. Why do we want to boot from the CD-ROM? Because we have downloaded a
Fedora 8 rescue CD image and we are going to boot *that* to do the copy!
So ... you've got your Fedora image ".iso" file ... tell VMware to use
that for the CD-ROM and boot the virtual machine.

d. It will come up in the menu ... go to the default "rescue" option. It
will ask you for a keyboard and language. It will ask you if you want to
configure the network. Say "no". It will ask you if you want to rescue
an image. You want to go to the "Skip" option.

e. Now you're "root" in a RAM disk. The first thing you need to do is
format the new hard drive. I usually do it manually with "fdisk", but
"parted" is also on the Fedora rescue CD if you want to use that. You
want a single primary partition, partition 1, spanning the entire disk.
The disk will be called /dev/sda.

f. Now execute the following commands:

mkfs.ext3 /dev/sda1
e2label /dev/sda1 OLPCRoot
mkdir /orig
mkdir /copy
mount /dev/sdb1 /orig
mount /dev/sda1 /copy
cp -a /orig/* /copy/

g. One last step and you've got it. Type "grub" at the shell prompt.
You'll get a "grub" prompt. Type "root (hd0,0)". It should find an
"ext2" filesystem. Then type "setup (hd0)". That puts the boot loader
into the boot sector.

h. Reboot. The system will come back up in the rescue CD, but you've got
about 60 second before it will do anything. Power down the virtual
machine. Go into the settings and remove the second hard drive (the
original image). Disconnect the ".iso" of the Fedora rescue CD. Close
the virtual machine. Make a zip archive of the whole virtual machine
directory if you want to.

Now you have a virtual XO with a larger hard drive. I usually make them
2 GB, but I've made some as large as the default, 8 GB.








More information about the Devel mailing list