“Universal Serial Bus” is today one of the most common interface available in the computer to communicate with it in various aspects. Having a mobile storage device that seamlessly (well, at least in possible situations) boots on a standard i386 based hardware and allows one to perform his/her work will definitely make the life a lot comfortable. LiveUSB distro is meant to serve this purpose.
Creating a LiveUSB distro using Ubuntu LiveCD iso on a typical Desktop PC / Laptop is explained with the following steps. These steps are meant to be for users already comfortable using command line utilities. For rest of the folks, there are readily available tools. Some of them are, UNetbootin and Liveusb.
Pre-requisites:
1. Install ‘gparted’, ‘syslinux’, ‘mtools’ and ‘squashfs-tools’ using Synaptic package manager or apt-get using a terminal.
2. Download the latest Ubuntu LiveCD distribution for Desktops, from www.ubuntulinux.org.
3. You need to have superuser access (sudo) or should be able to login as root since, below mentioned steps need superuser privileges.
Procedure / Steps:
1. Insert a bootable USB thumb drive of capacity >=4GB into the USB port on the Computer. Make sure that your device is capable of working as bootable USB device. Unfortunately, not all the USB drives available in the market are capable of supporting boot feature. Two of the known brands which can be used for the purpose here are Kingston, and SanDisk. Again, cross-check them before you actually buy them for this purpose. Finally, make sure that you have any data backed up from the drive before proceeding further. Since, the aim is to use the device for persistent storage, I recommend a minimum of 4GB.
2. Create 2 partitions on the inserted USB device by using ‘gparted’ tool. Make sure that you select your USB device properly from the list of scanned disk devices. You need to unmount any mounted partitions from the drive and delete them. Then, create first, primary FAT16 partition of ~1.2GB size and then, with rest of the freespace create second, EXT2 partition. One can use fdisk or cfdisk tools instead of gparted if familiar with them.
3. Close gparted tool. Open a terminal and format the newly created partitions as follows:
4. Create master boot record (mbr) on your USB device
5. Create two directories, in /tmp and mount the newly created partitions of the USB device on them.
6. Create a directory named livecd in /tmp and mount the LiveCD iso as loopback device.
7. Copy the contents of /tmp/livecd to /tmp/liveusb and do some tweaking as follows:
8. Copy the following two files into /tmp/liveusb as well as /tmp/casper-rw.
syslinux.cfg; isolinux.txt
9. Now, unmount the temporarily mounted stuff
10. Finally, install the boot-loader by running;
You may use the options -s and -f along with syslinux (Eg., syslinux -s -f /dev/sdX1)
That’s it! You have the LiveUSB. Now, remove it from the Computer and try it on any Desktop PC / Laptop that allows booting from USB storage device. You need to check in the BIOS to make sure that USB disk is the first boot device in the boot order or no other devices higher in the boot order can boot before USB disk. Enjoy with your persistent LiveUSB:-) drive.
Creating a LiveUSB distro using Ubuntu LiveCD iso on a typical Desktop PC / Laptop is explained with the following steps. These steps are meant to be for users already comfortable using command line utilities. For rest of the folks, there are readily available tools. Some of them are, UNetbootin and Liveusb.
Pre-requisites:
1. Install ‘gparted’, ‘syslinux’, ‘mtools’ and ‘squashfs-tools’ using Synaptic package manager or apt-get using a terminal.
2. Download the latest Ubuntu LiveCD distribution for Desktops, from www.ubuntulinux.org.
3. You need to have superuser access (sudo) or should be able to login as root since, below mentioned steps need superuser privileges.
Procedure / Steps:
1. Insert a bootable USB thumb drive of capacity >=4GB into the USB port on the Computer. Make sure that your device is capable of working as bootable USB device. Unfortunately, not all the USB drives available in the market are capable of supporting boot feature. Two of the known brands which can be used for the purpose here are Kingston, and SanDisk. Again, cross-check them before you actually buy them for this purpose. Finally, make sure that you have any data backed up from the drive before proceeding further. Since, the aim is to use the device for persistent storage, I recommend a minimum of 4GB.
2. Create 2 partitions on the inserted USB device by using ‘gparted’ tool. Make sure that you select your USB device properly from the list of scanned disk devices. You need to unmount any mounted partitions from the drive and delete them. Then, create first, primary FAT16 partition of ~1.2GB size and then, with rest of the freespace create second, EXT2 partition. One can use fdisk or cfdisk tools instead of gparted if familiar with them.
3. Close gparted tool. Open a terminal and format the newly created partitions as follows:
$> mkfs.vfat -F 16 -n liveusb /dev/sdX1where, X in sdX refers to the device letter. Please check for your USB device’s letter and replace it in place of X (Example, your device name may be sda, sdb, sdc, or ….)
$> mkfs.ext2 -b 4096 -L casper-rw /dev/sdX2
4. Create master boot record (mbr) on your USB device
$> dd if=/usr/lib/syslinux/mbr.bin of=/dev/sdX
5. Create two directories, in /tmp and mount the newly created partitions of the USB device on them.
$> mkdir -p /tmp/{liveusb,casper-rw}
$> mount /dev/sdX1 /tmp/liveusb
$> mount /dev/sdX2 /tmp/casper-rw
6. Create a directory named livecd in /tmp and mount the LiveCD iso as loopback device.
$> mkdir -p /tmp/livecdwhere, ‘/path/to/livecdiso’ is the absolute pathname to Ubuntu LiveCD iso image.
$> mount -o loop /path/to/livecdiso /tmp/livecd
7. Copy the contents of /tmp/livecd to /tmp/liveusb and do some tweaking as follows:
$> cp -rf /tmp/livecd/* /tmp/liveusb
$> mv /tmp/liveusb/isolinux/* /tmp/liveusb
$> rm -rf /tmp/liveusb/isolinux*
$> mv /tmp/liveusb/casper/initrd.gz /tmp/liveusb/casper/initrd.img
8. Copy the following two files into /tmp/liveusb as well as /tmp/casper-rw.
syslinux.cfg; isolinux.txt
9. Now, unmount the temporarily mounted stuff
$> umount /tmp/livecd
$> umount /tmp/casper-rw
$> umount /tmp/liveusb
10. Finally, install the boot-loader by running;
$> syslinux /dev/sdX1
You may use the options -s and -f along with syslinux (Eg., syslinux -s -f /dev/sdX1)
That’s it! You have the LiveUSB. Now, remove it from the Computer and try it on any Desktop PC / Laptop that allows booting from USB storage device. You need to check in the BIOS to make sure that USB disk is the first boot device in the boot order or no other devices higher in the boot order can boot before USB disk. Enjoy with your persistent LiveUSB:-) drive.