How to create an Ubuntu live USB for both Mac and PC

spent a week figuring this out. You can boot Ubuntu from a flash drive on an intel mac and easily. These instructions are for Ubuntu 9.10 and 10.04.

  • You will need: A working ubuntu installation
  • VM or real 1GB or larger flash drive
  • Working OS X installation
  • gparted
  • Administrator privileges on both mac and linux

First, open up Disk Utility (Utilities > Disk Utility) and format you drive with this:

   * GUID Partition Table
    * 4.2 MB Free Space at beginning of drive
    * 64 MB HFS+ (Mac Journaled)
    * 64 MB FAT for GRUB
    * 600MB FAT for Ubuntu Live
    * Rest of your drive FAT for data

Next, install rEFIt to your hard drive.

Then, install rEFIt to your flash drive:

# Copy the efi directory on / to your rEFIt partiton

# In Terminal.app (Utilities > Terminal), type "sudo ", drag the "enable.sh" file in /Volumes/rEFIt/efi/whatever into the terminal, and press enter.

Then, boot into Ubuntu and:

  1. Open gparted
  2. Select your flash drive in the top right corner
  3. Select your GRUB partition
  4. Right click, format as ext2
  5. Right click > Label and set as "Grub"
  6. Right click > Manage flags and check "boot" (if it is already checked, uncheck it then recheck it)
  7. Open System > Disk utility and mount your Grub partition
  8. Open a terminal
  9. Execute "sudo grub-install --root-directory=/media/Grub /dev/sdb". You should get no errors or warnings. If you do, you either didn't set the Grub partition's boot flag or left out the 4.2 MB free space at the beginning of the drive.

Now, to put Ubuntu on the flash drive:

  1. Mount your iso file or cd. For iso's, just use "Open with Archive Mounter".
  2. Select everything in the mounted iso and copy it to the Live CD partition of your flash drive with nautilus.
  3. You now have Ubuntu installed on your flash drive!

  To use the grub menu, in the Grub partition, create /boot/grub/grub.cfg and copy this into it:
 

menuentry "Chainload to HD" {
 set root=(hd1)
 chainloader +1
}
menuentry "Ubuntu Live" {
 set root=(hd0,3) # Replace this with you Live partition
 linux /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash
 initrd /casper/initrd.lz
}

To boot into linux, reboot holding the option key and select the rEFIt option for your flash drive, then select boot linux from your HD (the one with the USB picture above it). If your flash drive doesn't show up when you use the option key, reinstall rEFIt to your flash drive.

In a little while, I will edit in how to save your home directory.

Edit: Alright, now for saving your home directory.
Boot into your live linux and copy the /home/ubuntu to your data partition. Name it however you like. Save the following text as "Mount.sh", and of course, change the <the folder you just copied part>.
 

# Mount the home directory
sudo mount --bind /media/DATA/<the folder you just copied> /home/ubuntu
# Log out and restart X
sudo killall -9 Xorg

To use your new home, just run the Mount.sh file. It will log you out. Log in with "ubuntu" as your username and "" for your password. It will take longer to log in this way and you will probably get an error about ICE something. You can save your changes now.

Original article here.

© 2002-2012 Jeroen Diederen. Drupal theme by Kiwi Themes.