Linux is a relatively lightweight operating system and can be run quite effectively from a USB flash drive. This can be very useful when trying to retrieve files from a PC with a corrupt OS or boot sector. Most PCs manufactured in the last couple of years will allow you to boot from a USB device but you may have to enter the computer’s BIOS to enable this functionality. This tutorial enables you to install, boot and run Ubuntu Linux 7.10 Gutsy Gibbon from a USB flash drive. In addition to installing Ubuntu to the USB device and then booting from it, this also enables you to automatically save your changes and settings back to the flash drive and restore them on each boot using a second persistent partition.
You will need:
- Ubuntu 7.10 ISO image
- DVD Burner
- Blank writeable DVD
- 2GB USB flash drive
- The computer on which you are working must have internet access
Throughout the following instructions, replace X with your drive letter:
- Grab the Ubuntu 7.10 ISO image and burn it to a DVD
- Insert the CD and your USB flash drive
- Reboot your computer into Ubuntu from the CD
- Open a terminal window and type sudo su
- Type fdisk -l to list available partitions. Note which device is your flash drive (example: /dev/sda). Throughout these instructions, replace x with your flash drive letter. For example, if your flash drive is sdb, replace x with b.
- Type umount /dev/sdx1
- Type fdisk /dev/sdx
- Type p to show the existing partition and d to delete it
- Type p again to show any remaining partitions (if partitions exist, repeat the previous step)
- Type n to make a new partition
- type p for primary partition
- type 1 to make this the first partition
- Hit enter to use the default 1st cylinder
- Type +750M to set the partition size
- Type a to make this partition active
- Type 1 to select partition 1
- Type t to change the partition filesystem
- Type 6 to select the fat16 file
- Type n to make another new partition
- Type p for primary partition
- Type 2 to make this the second partition
- Hit enter to use the default cylinder
- Hit enter again to use the default last cylinder
- Type w to write the new partition table
- Type umount /dev/sdx1 to ensure the 1st partition is unmounted
- Type mkfs.vfat -F 16 -n ubuntu710 /dev/sdx1 to format the first partition
- Type umount /dev/sdx2 just to ensure the 2nd partition is unmounted
- Type mkfs.ext2 -b 4096 -L casper-rw /dev/sdx2 to format the second partition
- Remove and re-insert your USB flash drive
- Type apt-get update
- Type apt-get install syslinux mtools
- Type syslinux -sf /dev/sdx1
- Type cd /cdrom
- Type cp -rf casper disctree dists install pics pool preseed .disk isolinux/* md5sum.txt README.diskdefines ubuntu.ico casper/vmlinuz casper/initrd.gz /media/ubuntu710/ (ignore any cannot create symbolic link errors)
- Type cd /home/ubuntu
- Type wget pendrivelinux.com/downloads/U710fix.zip
- Type unzip -o -d /media/ubuntu710/ U710fix.zip
- Restart your computer, set your BIOS or Boot Menu to boot from the USB device and reboot again.
You will now have a USB flash drive running Ubuntu 7.10 Gutsy Gibbon that will automatically save your changes, restoring them on boot. If you have trouble getting Ubuntu to boot, your memory stick may have a corrupted Master Boot Record (MBR). To repair the MBR of your USB device, at the terminal type sudo apt-get install lilo followed by lilo -M /dev/sdx (again replacing x with the letter of your flash device).
This entry was posted
on Thursday, October 25th, 2007 at 10:01 and is filed under Linux.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.