Skip to main content

Making persistant liveUSB from liveCD image

“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.


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

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/sdX1
$> mkfs.ext2 -b 4096 -L casper-rw /dev/sdX2
where, 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 ….)

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/livecd
$> mount -o loop /path/to/livecdiso /tmp/livecd
where, ‘/path/to/livecdiso’ is the absolute pathname to Ubuntu LiveCD iso image.

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.


Popular posts from this blog

Debian Squeeze and Mac OSX Lion - Dual boot

With Mac OSX Snow Leopard, things were much simpler to install and run a Linux operating system just by using rEFIt boot manager utility, on my Mac Mini(4,1 Mid-2010 model). With the introduction of Lion, Apple has introduced a hidden, OS recovery partition. In total, there will be 3 partitions for Mac OSX alone, for Lion. They are ESP (EFI System Partition), Mac OSX installation partition and, the OS recovery partition. Also, as per the GUID Partition Table(GPT) which Mac uses, there can be maximum of 4 primary partitions, with no scope for Extended partitions like in typical MSDOS Partition Table setup. It is also recommended to follow GPT when using Mac.

With all these constraints, I'm actually left with one partition where I can install and run GNU/Linux (in this case, Debian Squeeze). I didn't try resizing an existing Mac OSX installation partition and creating an Ext4 partition for Linux. Rather, I choose to go for fresh installation. You can try with the resizing method…

Using USB CDMA modem to setup a home/private WiFi network

The idea here is to give a ‘how-to’ on setting up a a home WiFi network using mobile, CDMA based USB modem, hoping that bandwidth that you obtain from this service is satisfactory :-)

Hardware Requirements:
Linux PC/Notebook/Netbook
Wifi Access point connected to ethernet port of the Linux box
CDMA-1x USB Modem (Device used: Reliance M880)

Software/OS Requirements:
Linux Operating System with “usbserial” and “cdc_acm” device driver modules
“pppd”, “wvdial”, “iptables”, and “dnsmasq” applications and their dependencies installed on the System

Setup: The steps followed in setting up this CDMA based connectivity can be split into 3 steps, as follows.
Configuring kernel modules for auto-loading at bootupConfiguring “wvdial” application for dialup / ppp connectionInitializing / starting the CDMA modem connectionSetting up “iptables” for NAT forwardingSetting up “dnsmasq” for resolving DNS and as DHCP server
Configuring kernel modules for auto-loading at bootup
Open a terminal and type the co…

Creating GRUB/Syslinux splash images

GRUB splash image creation:
Open GIMP application.Create an image of size 640x480 pixels. You may open an existing image and resize it too.Reduce the number of colors to 14 by selecting menu item “Image->Mode->Indexed”. Don’t use any color dithering.Save the resulting image as splash.xpm and close GIMP.Compress the image file by running; gzip splash.xpmCopy the resulting splash.xpm.gz file to /boot/grub.Run update-grub to upgrade the grub configuration to include this splash image.
Syslinux splash image creation:
Open GIMP application.Create an image of size 640x480 pixels. You may open an existing image and resize it too.Reduce the number of colors to 14 by selecting menu item “Image->Mode->Indexed”. Don’t use any color dithering.Save the resulting image as splash.ppm and close GIMP.Install the package syslinux-common by running; apt-get install syslinux-common as sudo/root. Convert the saved image to syslinux format by running; ppmtolss16 ‘#ffffff=7’ <splash.ppm >spl…