Featured Post

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 bootup Configuring “wvdial” application for dialup / ppp connection Initializing / starting the CDMA modem connection Setting up “iptables” for NAT forwarding Setting up “dnsmasq” for resolving DNS and as DHCP server Configuring kernel modules for auto-loading at bootup Open

Creating Linux filesystem images

I’m sharing the following script which creates a filesystem image of desired size (in kBs) for use in building an installUSB/LiveUSB Pen-drive image or for similar uses. I have written this in my effort to create a installUSB image for Debian-Lenny. Hope it is of some help to somebody:-). You may copy the italicized/quoted text below into a new text file and save it as a shell script (.sh extension). Don’t forget to set its executable bit;-) and also, please don’t forget to leave your comments/feedbacks.

Note: It currently creates images for fat16, fat32, ext2 and ext3 and you should run it as root/superuser (sudo). You can extend this script to generate fs images for other filesystem types as well.

Usage: script-name fs-type output-file required-size-kB
Ex.,; ./mk-hdd-img.sh ext3 myimage.img 600000
This will create a filesytem image called myimage.img of type ext3 and of size ~600MB.


if [ $UID -ne 0 ]; then
    echo “You need superuser/root privileges to run this.”
    exit 1

if [ $# -ne 3 ]; then
    echo “Usage: `basename $0` “
    exit 2


make_img () {
    if [ -e “$HDD_IMG_NAME” ]; then
        echo “Failed!”
        echo “Image file $HDD_IMG_NAME already exits!!!”
        echo “Please remove the image and try again.”

        exit 4

    dd if=/dev/zero of=$HDD_IMG_NAME bs=$BLOCK_SIZE count=$IMG_KB_SIZE
    sync; sleep 2

echo “Trying to create HDD image with $1 filesystem…. “

case “$1” in
        mkfs.vfat -F 16 “$HDD_IMG_NAME” $IMG_KB_SIZE &> /dev/null 2>&1;;
        mkfs.vfat -F 32 “$HDD_IMG_NAME” $IMG_KB_SIZE &> /dev/null 2>&1;;
        mkfs.ext2 -F -b $BLOCK_SIZE “$HDD_IMG_NAME” $IMG_KB_SIZE &> /dev/null 2>&1;;
        mkfs.ext3 -F -b $BLOCK_SIZE “$HDD_IMG_NAME” $IMG_KB_SIZE &> /dev/null 2>&1;;
        echo “Failed!”
        echo “Filesystem of type $1 is not supported!”
        echo “Only fat16, fat32, ext2, ext3 are supported”
        exit 3;;

echo “Done.”
exit 0


Popular posts from this blog

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

How to extract an initrd image

Debian Squeeze and Mac OSX Lion - Dual boot