If you do not plan to use a Windows XP partition on the same stick, then you need to replace all future references to partition 2 with partition 1, partition 3 with partition 2, etc. This guide will assume you setup partition 1 with Windows XP. Note that XP only recognizes partition 1 to be a valid USB stick partition.
-
If you are not running (K)ubuntu Edgy 6.10 reboot your computer into Ubuntu from the Live CD
Insert your USB flash drive
Open a terminal window and type sudo -s
Type fdisk -l to list available drives/partitions. Note which device is your flash drive (In my case: /dev/sdb). Throughout this tutorial, replace b with your flash drive letter. For example, if your flash drive is sdf, replace b with f.
type umount /dev/sdb1
repeat for other partitions if you stick contains more than one partition
type fdisk /dev/sdb
type p to show the existing partition and d to delete it
if your stick contains more than one partition: enter partition number to confirm delete, then repeat until all partitions are deleted
type n to make a new partition
type p for primary partition
hit enter to use the default 1st cylinder
type
+sizeM to set the partition size to size
MB. For a 16GB stick, a reasonable size would be 12GB, e.g. type +12000M. verify with
p that the partition is allocated with the correct size.
type t to change the partition filesystem
type 7 to select the NTFS file system
type n to make a new partition. This will be the “live” partition which will not be modified during usage and needs to have a FAT file system.
type p for primary partition
type 2 to make this the second partition
hit enter to use the default cylinder
type +700M to set the partition size
type a to make this partition active
type 2 to select partition 2
type t to change the partition filesystem
type 2 to select partition 2
type 6 to select the FAT16 file system
type n to make another new partition
type p for primary partition
type 3 to make this the third 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 and quit fdisk
Type umount /dev/sdb2 to ensure the 2nd partition is unmounted
Type mkfs.vfat -F 16 -n edgy /dev/sdb2 to format the 2nd partition which is the Ubuntu live partition the boot loader will boot into (note: you may choose any name to replace edgy)
Type umount /dev/sdb3 to ensure the 3rd partition is unmounted
Type mkfs.ext2 -b 4096 -L casper-rw /dev/sdb3 to format the 3rd partition which is the extension partition where all your later changes to the base system will be safed (note: the partition label casper-rw must be entered with the exact spelling and in lower case. This partition will be invisible once you run (K)ubuntu from the stick)
formatting the Windows XP partition must be done from a running XP system (see next paragraph)
Remove and Re-insert your flash drive
Type apt-get install syslinux mtools (to obtain the boot manager)
Type syslinux -sf /dev/sdb2
Download this custom
usyslinux.tar file and extract the
syslinux.cfg file to /media/edgy (the root directory of /dev/sdb2)
Type cd /media/cdrom0 (running installed Edgy) or cd /cdrom (running the Edgy LiveCD)
Type cp -rf casper disctree dists install pics pool preseed .disk isolinux/* md5sum.txt README.diskdefines kubuntu.ico casper/vmlinuz casper/initrd.gz install/mt86plus /media/edgy/
If you are installing Ubuntu from a running Ubuntu Edgy, replace kubuntu.ico with ubuntu.ico. Note that there are 2 error messages when the copy finishes, indicating that 2 sym links could not be copied. Just ignore the message, these sym links are not necessary to be copied.
Type apt-get install lilo. You can later uninstall lilo after having installed the MBR to the stick.
Type lilo -M /dev/sdb to install a bootable MBR
Reboot your computer and set your system BIOS to allow booting from USB devices. Also set the boot priority if necessary. Leave the stick in the USB port to boot from the stick.
If everything has gone as it should, you should now be able to boot Ubuntu from the USB flash device and it should save your changes, restoring them on boot.