There was an error in this gadget

Saturday, September 24, 2011

Installing a 1 GB swap without partitioning

              Some software that you install e.g. oracle database XE requires you to have greater than one GB swap space. So, if you have not created a swap partition of greater than 1GB just because you have lot of RAM, you may land in a fix so as what do now . Although  , in ubuntu , you can easily use GParted to create a new swap space but some times you don't have enough free space or don't want to take risk of using GParted . Also , GParted is not installed by default ( u can get it from Ubuntu Live Disk ). So, we need some process by which we can have some extra swap space without using GParted.

To install a 1 GB swapfile named swapfile in /  ( root directory) , use the following steps in the terminal :

1) sudo -s 

   ( to gain root privilage, its optional , but if you don't do this then you have to append sudo to each of the following commands )

2) dd if=/dev/zero of=/swapfile bs=1024 count=1048576  

   (this may take a while)  ( 1048576 == 1 x 1024 x 1024 , 1GB == 1048576 KB)

3) mkswap /swapfile

    ( ignore any error )

4) swapon /swapfile
    ( to turn on the swap )
5) cp /etc/fstab /etc/fstab.orig

    ( back-up the fstab before editing )

6) echo '/swapfile swap swap defaults 0 0' >> /etc/fstab
    ( adds the entry of  new swap to fstab for mounting the file at boot time )

7) To  Verify:

   swapon -a ; swapon -s

If at anytime u want to delete the swap then :

   sudo swapoff -a
   sudo rm /swapfile

   sudo cp /etc/fstab /etc/fstab.changed ; sudo cp /etc/fstab.orig /etc/fstab

   sudo swapon -a ; swapon -s

Friday, September 23, 2011

locating and correcting bad blocks/sectors of pen-drive

              Sometimes, we drop our pen-drive in some water container and our pen-drive either refuses to get detected or files not getting copied to it. We can use our Incredible Ubuntu operating system to get it working. Find below the steps for the same.

Note : 
1) It is a time-consuming process. Use the 2nd steps only if you actually find any bad-block.
2) All steps need Ubuntu live disk and back-up of data to avoid any loss.

3) The process can be well applied to a hard-disk.

 Steps for locating and correcting bad blocks/sectors of the pen-drive :

1) Boot from Ubuntu live disk , open Gparted and check for partition name ( e.g. /dev/sdh1 )  and use the same to replace /dev/sdh1

2) Looking for bad blocks ( via terminal )

The first step is to locate the bad blocks of each partition. Type in the following command to do a search using the non-destructive way (-n), showing the progress (-s) and dumping the bad blocks in the file "badblocks_1GB01.txt" .

sudo badblocks -n -s -v /dev/sdh1 -o badblocks_1GB01.txt

2) Formatting the drive

You have to pass the list of blocks obtained in the previous step, for which the command to use to format in FAT32 is:

sudo mkdosfs -F32 -v -n "1GB" -l badblocks_1GB01.txt /dev/sdh1

Here -F32 is for FAT32 partition and "1GB" is the partition size .

This will render the badblocks un-available for use leaving all the usable blocks on the pen-drive for use.

Thursday, September 22, 2011

Installing Sun JRE (Java Run-time Environment ) in Ubuntu

Installing Sun JRE (Java Run-time Environment ) in Ubuntu

# Steps to install Sun JRE :

1) Download the bin file ( Linux self-extracting ) from here :

2) make the file executable :

      chmod u+x <file>
3) Get the root access :

         sudo -s
( It will prompt for your password )

4) Go to /usr directory :

          cd /usr
5) Make a directory named java

          mkdir java
6) Go to the java directory :

          cd java
7) run the downloaded file with full path :


This will install the JRE in your system.
# Additional Steps to install firefox-4.0 plugin

8) Go to firefox plugin directory :

        cd /usr/lib/firefox-4.0/plugins/
9) Create a link for the plugin :

       ln -s /usr/java/jre1.6.0_24/lib/i386/
10) For confirming the installation of plugin, close all firefox windows and re-open it .

Type in :

in the awesome bar ( as firefox calls it ) and pressing enter key .

11) You can also confirm the installation of java plugin by the following link :

Courtesy :
Also available at :

Wednesday, September 21, 2011

Firewall in Ubuntu

     Ubuntu , as with all post 2.2/2.4 kernel Linux distributions comes with the netfilter/iptables framework. This framework is a set of kernel modules that can be utilized to create packet filtering rules at the kernel level. Rules are written in iptables format, which is the method of conveyance of instructions to netfilter, and in essence the Linux Kernel.

        Ubuntu also includes an application called Uncomplicated FireWall (UFW). This application is a userspace application that essentially can be used to create iptables rules. There is also a GUI for UFW called GUFW. It provides a graphical interface for UFW. 
         The command-line interface of UFW is installed by default in ubuntu.

Manual page can be seen by command :

                                    man ufw

If you want to see its current status, then it can be done by command :

                                  sudo ufw status
For enabling the firewall :

                                  sudo ufw enable

Note : The command for enabling the firewall, also puts it into the list of startup programs.

Installing minimal form of ubuntu

               The Minimal CD will download packages from online archives at installation time instead of providing them on the install CD itself. Downloading packages at install time reduces the size of the install CD to approximately 5 to 20MB depending on architecture (see below), as well as providing only the packages needed for installation. The download time savings achieved by using a Minimal CD can be significant, as only current packages are downloaded, so there is no need to upgrade packages immediately after installation. The Minimal CD uses a text-based installer like the Alternate CD, making the CD image as compact as possible.

                To use the Minimal CD download mini.iso from one of the following links given below and burn it to a CD.

                  To install, boot your computer from the the Minimal CD and type "cli" (command line install) at the prompt. You can then follow the instructions from the text-based installer. After the base system is installed, log in, and type "sudo tasksel" to select the system to install.

Links :
32-bit PC (x86)

Name : Ubuntu 11.04 "Natty Narwhal" Minimal CD 
Size : 19MB 
MD5 : cc1591035877c317fdef7f4ebf1662b9  SHA1:d86f78c8343009e57b0ecda14592e76802ce1ec4

64-bit PC (amd64, x86_64)

Name : Ubuntu 11.04 "Natty Narwhal" Minimal CD 
Size : 22MB 
MD5: 13507ac70863edd2df11cdd6260011ba 
SHA1: 971f67b98323f090f3609f5c7fe78478d564122d