Thursday 26 April 2012

Creating a Live USB with MAC and Windows



Live USB
A live USB is a USB flash drive or a USB external hard disk drive containing a full operating system that can be booted. Live USBs are closely related to live CDs, but sometimes have the ability to persistently save settings and permanently install software packages back onto the USB device.


Example
Here's an example, we would like to take a distribution of ubuntu linux, and install it on to a USB Flash Drive. We can then insert it into a machine, change the BIOS order, and boot directly from the USB and use the OS directly on the flash drive.


MAC OS X

1. [Optional] If your OS image (I.e. ubuntu-11.10-desktop-i386.iso) is an ISO file, we need to convert this into .img format. We can do this by using the hdiutil utility.

Code Snippet
  1. hdiutil convert -format UDRW -o ubuntu-11.10-desktop-i386.img ubuntu-11.10-desktop-i386.iso
End of Code Snippet


2. Enter this command into a Terminal window...
Code Snippet
  1. diskutil list
End of Code Snippet

We need to identify which drive is our USB Flash Drive. If you cannot tell, then run the command before inserting drive, and again, afterwards. You will notice which entry belongs to the newly inserted drive. I.e. /dev/disk3


3. Mac OS X will automatically mount the memory stick into Finder, so we must unmount the drive (This is not the same as ejecting it) and it will prevent us from seeing "Resource Busy" errors.
Code Snippet
  1. sudo diskutil umountDisk /dev/diskX
End of Code Snippet

(Where diskX is the disk corresponding to your USB Flash Drive).


4. We can now use dd to extract the image on to the disk.
Code Snippet
  1. sudo dd if=ubuntu-11.10-desktop-i386.img of=/dev/diskX bs=1m
End of Code Snippet

(Where diskX is the disk corresponding to your USB Flash Drive). This step may take a while depending on the size of the image.


5. Eject the flash disk using diskutil.
Code Snippet
  1. diskutil eject /dev/diskX
End of Code Snippet


(Where diskX is the disk corresponding to your USB Flash Drive).


You can now boot directly from the USB into your loaded operating system. Remember to go into the BIOS on the host system and change the Boot Priority, making the USB Flash Drive higher than the host HDD itself.



Windows

Windows users have a few options, you can repeat the above steps with a verison of dd for windows, however I have found that the following method is by far easiest!

1. Download your required operation system (.iso, .img etc)

2. Download Linux Live USB Creator

3. Launch Linux Live USB Creator, specify the OS image, the target Flash Drive (make sure its plugged in) and simply click the Lightning logo. All done!


You can now boot directly from the USB into your loaded operating system. Remember to go into the BIOS on the host system and change the Boot Priority, making the USB Flash Drive higher than the host HDD itself.

No comments: