How to install Ubuntu from a USB stick
Submitted by thijs on 3 March, 2009 - 14:50I found myself having to reinstall a server with no CD drive available. I had an old USB stick (256MB) lying around so I thought it would be nice to use that as an installer. Here's how I did it.
- Install syslinux and mbr, which you will need later:
apt-get install syslinux mbr - Connect the USB stick and use
dmesgto find out what the device name is. Then, usefdiskto make a partition. Make it type fat16 and assign the boot flag to the partition. Quit fdisk. - Type
mkfs.vfat /dev/sdb1(substitute your device name) to create a fat filesystem. - Type
syslinux /dev/sdb1to install the syslinux bootloader. - Get one of the mini.iso's from Ubuntu. I used the amd64 version but there is also an i386 version (Links to 8.10, Intrepid Ibex).
- Mount the .iso:
mount -o loop ~/mini.iso /media/cdrom0 - Take out the USB stick and connect it again. It will be mounted automatically (in my case at /media/disk).
- Copy the contents to the USB stick:
cp -r /media/cdrom0/* /media/disk/ - Rename isolinux.cfg:
cd /media/disk; mv isolinux.cfg syslinux.cfg - Finally, install a Master Boot Record on the stick:
install-mbr /dev/sdb
Use the stick to boot the server and perform the installation as usual.
Note: The installer finishes by installing Grub in the MBR of the first harddisk it encounters. This will be a problem if the USB Stick is detected as the first. The result will be an unbootable HD (Grub error 2) and an unusable stick (Grub error 15). It might also be that the server will boot from the HD if you insert the USB stick. This will depend on the configuration of your server. The solution is to re-prepare the stick like above, boot from it, enter rescue mode, answer all the questions until you get to the bootloader part, and install Grub in the MBR of the right disk.
Reference: Ubuntu Community Docs

Post new comment