Making an Ubuntu flash image from an ISO
This article shows the process required to create a flash image from an ISO.
There are many ways to accomplish this, but I am going to focus on how to do it with a Mac, VMware fusion, an Ubuntu VM and a program called Unetbootin.
It may seem like a convoluted solution, but, as it turns out, it was faster to install a Ubuntu VM and install Unetbootin than it was to figure out a native way of doing this solely on my mac. The results of this work can be downloaded from a popular torrent site.
Vmware Fusion
Install Vmware Fusion. If you have a mac, you really need to get this. It will let you run windows, linux, ESX server and you can try out new distros easily. It's a must-have for any self-respecting computer nerd.
Get Ubuntu
Go get the ubuntu ISO. You will need this both to make your flash image and to build your linux VM in Fusion. I recommend you build your VM as jaunty. If the Distro ISO you want to convert to an IMG is different, then you'll need to get that one too, obviousy.
Jaunty can be downloaded here:
http://www.ubuntu.com/getubuntu/download
Build a VM
Build a Jaunty VM. Trust me, it will be very nice to have a linux VM lying around for when you need it. The new VMware Fusion supports Ubuntu really well, so just follow the steps of the wizard. When it asks for media, tell it you have an ISO and select the version of Ubuntu you downloaded. For me, the file was ubuntu-9.04-desktop-i386.iso. The install is very straightforward.
Update Jaunty
Make sure your Ubuntu VM is up to date by letting the update manager do its thing. Then, install unetbootin from the standard repositories. There are several ways to do that, but the simplest is to do a:
sudo apt-get install unetbootinfrom the command line.
Once installed, you can find the program in Applications->System Tools->UNetBootIn
Run UNetBootIn
Run UNetBootIn. Choose the diskimage option and select the ISO you wish to convert into a flash boot. Make sure you have the USB thumbdrive installed before you start UnetBootIn.
Choose the USB drive from the drop down menu labeled 'Drive:' and hit ok. It should take about 10 minutes and when finished gives you a bootable USB flash drive with an installable (or live USB ) Ubuntu on it.
Make an image
If you only needed a flash install disk, then you are done.
Of course, now we can also create an image file for future use. If you just needed an installable flash drive you have it, and can safely skip this step. If you want to now create an image for later use, read on.
Unmount your flash drive from your Ubuntu VM, and disconnect the device from your VMware guest. The USB flash drive should now mount on your mac desktop. If not, then pull it out and put it back in. You should see the volume on your Mac desktop. Feel free to browse around it and verify there are files in it.
Now, We are essentially going to follow the 'reverse' steps from the Ubuntu help page on this topic:
https://help.ubuntu.com/community/Installation/FromImgFiles
First, Open a Terminal (in /Applications/Utilities/)
Run diskutil list and determine the device node assigned to your flash media (e.g. /dev/disk2)
Run diskutil unmountDisk /dev/diskN (replace N with the disk number from the last command; in the previous example, N would be 2)
Execute the following command on the command line:
sudo dd if=/dev/diskN of=/path/to/YourNewImage bs=1m count=990
replace /path/to/YourNewImage with the path where the image file is to be located; for example:
~/Desktop/ubuntu-9.04-desktop-i386.img
If you see the error dd: Invalid number `1m', you are using GNU dd. Use the same command but replace bs=1m with bs=1M.
the 'bs' argument specifies the block size to read and write, and the 'count' argument tells dd how many blocks to copy. It has to be enough blocks to get all the data.
You can eliminate the 'count' argument, but then dd will copy your entire flash drive, including the empty space, potentially resulting in a very large img file.
Run diskutil eject /dev/diskN and remove your flash media when the command completes
With slight modifications, you could have run these commands on your linux VM (or a real linux box, for that matter).
Flashing a new thumb drive
If you did the last step, you can keep the .img file around and reclaim your jumpdrive when you are done with your install.
Then, if you ever need to do another install simply follow the procedure(s) from
https://help.ubuntu.com/community/Installation/FromImgFiles.
On a Mac, these would be:
Get your desired .img file
Open a Terminal (in /Applications/Utilities/)
Run diskutil list to get the current list of devices
Insert your flash media
Run diskutil list again and determine the device node assigned to your flash media (e.g. /dev/disk2)
Run diskutil unmountDisk /dev/diskN (replace N with the disk number from the last command; in the previous example, N would be 2)
Execute sudo dd if=/path/to/downloaded.img of=/dev/diskN bs=1m (replace /path/to/downloaded.img with the path where the image file is located; for example, ./ubuntu.img).
If you see the error dd: Invalid number `1m', you are using GNU dd. Use the same command but replace bs=1m with bs=1M.
Run diskutil eject /dev/diskN and remove your flash media when the command completes.
Since I followed my own procedure on Ubuntu 9.04 for my Dell Mini 10, I have uploaded the resulting .img file for everyone to share:
http://thepiratebay.org/torrent/5029237





Comments
Post new comment