Copy hard disks or partitions using dd

Warning: The following is for personal note only, and is not meant to be a tutorial or guide.

On Debian server at work, we have /home reside on /dev/hda6 and I want to move to a new hard disk /dev/hdb.

First, I need to format /dev/hdb using fdisk. Then use dd to copy the content from /dev/hda6 to /dev/hdb1, the newly createdd ext3 partition.

# dd if=/dev/hda6 of=/dev/hdb1 bs=1024

The above commands instruct dd to read the content from /dev/hda6 and write it to /dev/hdb1. bs=1024 sets the block size to 1024 bytes.

dd takes a while depends on how big is your hard disk. Then, there is one final step to do — to re-size /dev/hdb1 to its maximum capacity.

# e2fsck -f /dev/hdb1

Now we can resize the file system in /dev/dhb1 partition. If we don’t specify the size, then resize2fs will assume the largest:

# resize2fs /dev/hdb1

# fsck -n /dev/hb1


Remove Universal Access Preference icon from Gnome panel

One of the advantages of using GNU/Linux operating system is that you hardly have to restart it. I have Debian on my laptop and it’s been running for months, until last night. It crashed and froze. Anyway, that’s not the main point this post was written.

After restarting, I saw this new icon in the Gnome top panel (the third icon from the right):


Well, for the start, I don’t know what it is and I don’t think I will have a need for it either. So I wanted to remove it, but right click on this icon would do nothing. Left clicked on it would give me some setting option, but nowhere does it mention how to remove it.

Thanks to the tip from Ubutu Forum, someone has found a solution. Basically, you need to go the “Keyboard Preferences” and untick the “Accessibility features can be toggled  with keyboard shortcuts“.

The following is the step by step guide:

On Debian, from the menu panel, click on System -> Preferences -> Keyboard (alternatively, you can just type gnome-keyboard-properties from the Terminal)

Screenshot-Keyboard Preferences

Then, untick or uncheck the Accessibility features can be toggled  with keyboard shortcuts and click on Close button. The undesired icon shall disappear.

Credit: How to remove universal access from notification area

Pidgin 2.5.5 – cannot connect to Yahoo messenger

I just noticed the abnormality with Pidgin 2.5.5 (running on Debian) these few days — I couldn’t connect my Yahoo messenger account at all. According to the discussion of Bug #389278 it appears that Yahoo was trying to change its protocol.

A quick way to have Pidgin connecting to Yahoo messenger server again is to change the Pager server setting for the Yahoo account in Pidgin.

To do this, from Pidgin:

  • Manage Accounts (Ctrl + A)
  • Select the Yahoo account from the list (assuming you’ve set one up before), and click Modify
  • Click on Advanced tab, under the Yahoo Options, in the Pager server field replace with

Try to connect to Yahoo messenger server again. It worked for me.

Credit: Bug #389278 in pidgin (Ubuntu)


Please cosider upgrade your Pidgin to version 2.5.7. I just upgraded mine and the problem seems to have gone away. Don’t forget to change the Page Server back to

Restore MySQL config file

I have installed mysql-server on my laptop running Debian back in awhile. For that reason, I forgot the root password. Just recently, I need to use MySQL server for one of my assignments. So, I was playing around in /etc/mysql/ directory hoping that I could get rid of the server and then reinstall it. The commands apt-get remove mysql-server didn’t seem to remove files/directories related to MySQL. Then, I decided to delete the /etc/mysql/ manually.

After I reinstalled mysql-server, a few config files ,contained in /etc/mysql direcotry, were never reinstalled. As always, I turned to Google for helps. With a few different combination of keywords, I found a solution to problem.

First, let’s completely remove mysql-server:

$ sudo apt-get remove --purge mysql-common
$ sudo apt-get remove mysql-server

Then reinstall mysql-server again:

$ sudo apt-get install mysql-common mysql-server

This time, I carefully chose a root password which was easy enough to remember. And voilla, it worked!

$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 5.0.45-Debian_1-log Debian etch distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.


Tomcat 6 on Debian Lenny

I need to install Tomcat 6 for a school assignment. I thought the installation process was easy as counting 123, but it turned out to be a few hours long of head scratching. Well, the first start is to setup a few environment variables as required by Tomcat:

export CATALINA_BASE# JAVA_HOME and Path to java, javac
export JAVA_HOME;
export PATH=${JAVA_HOME}/bin:${PATH}:.

It can be stored in a file, and run with source to load those variables.

Then when I tried to run Tomcat with the following command, there was some error with the BASEDIR:

kenno@kampongcham:~$ $CATALINA_HOME/bin/
The BASEDIR environment variable is not defined correctly
This environment variable is needed to run this program

I wasted a few hours trying to search for solutions on Google, and as when I was about to temporarily give up for dinner, I found an unexpected answer from one of the blogs.

“I need to set all the shell scripts in $CATALINA_HOME/bin to be executable”

So let’s fix it:

kenno@kampongcham:~$ cd $CATALINA_HOME/bin
kenno@kampongcham:~/bin/apache-tomcat-6.0.13/bin$ chmod +x *.sh

Finally, it’s done. We can now run tomcat without any errors:

kenno@kampongcham:~/bin/apache-tomcat-6.0.13/bin$ ./
Using CATALINA_BASE:   /home/kenno/bin/apache-tomcat-6.0.13
Using CATALINA_HOME:   /home/kenno/bin/apache-tomcat-6.0.13
Using CATALINA_TMPDIR: /home/kenno/bin/apache-tomcat-6.0.13/temp
Using JRE_HOME:       /usr/lib/j2sdk1.6-sun/bin

That’s it folks. When you setup Tomcat on your machine, make sure you specify the correct path to all the variables mentioned above.

Thanks to Michael for the solution: Tomcat 6 on OSX