Archive for the 'linux' Category

Create a hard disk clone in linux

Monday, April 23rd, 2007

Recently I bought a new hard drive for my ubuntu box to use it as a primary disk. I didnt want to re-install every piece of software, so I created a clone of my old disk to the new.

This is the linux command I used:

dd if=/dev/hdb of=/dev/hda bs=1M

What this command does, is to tell the system to copy every byte of data in 1MB increments from the /dev/hdb drive to the /dev/hda drive. In order to do this, you will have to boot from a live cd.

My system used the secondary hard drive as the main drive.

The old disk was an 80gb seagate drive, while the new is an 250gb, also seagate. The process completed around 40 minutes later. The next step was to change the grub menu.lst and replace every occurrence of hdb to hda. I could avoid this step if I made the new drive a secondary drive instead of primary. I also had to change the occurences of hdb to hda in the /etc/fstab file.

Then, I unplugged the power cable from the old hard drive, changed the boot drive bios setting and rebooted the system. Everything worked perfect.

When I used the ‘Gnome Partition Editor’ application to view the partitions of the new hard drive, I saw that all partitions were duplicated from the old drive to the new. The remaining space was unallocated, so I formatted as a new ext3 partition.

Ubuntu sources.list file

Thursday, April 19th, 2007

This might be useful:

http://www.ubuntu-nl.org/source-o-matic/

It is a generator for the /etc/apt/sources.list file

Ubuntu: Installing java the easy way

Thursday, April 19th, 2007

This guide will help you install the sun java  version without  having to deal with fakeroot.
Edit your /etc/apt/sources.list file

Add the following (if not already there)

deb http://us.archive.ubuntu.com/ubuntu dapper main restricted
deb http://us.archive.ubuntu.com/ubuntu dapper universe multiverse

Run:

sudo apt-get update

and

sudo apt-get install sun-java5-jdk

Accept the license agreement

If you have already installed an older java version run:

sudo update-alternatives –config java

and chose the appropriate version:

msti@msti:~$ sudo update-alternatives –config java

There are 3 alternatives which provide `java’.

Selection Alternative
———————————————–
1 /usr/bin/gij-wrapper-4.1
*+ 2 /usr/lib/jvm/java-gcj/jre/bin/java
3 /usr/lib/jvm/java-1.5.0-sun/jre/bin/java

Press enter to keep the default[*], or type selection number: 3
Using `/usr/lib/jvm/java-1.5.0-sun/jre/bin/java’ to provide `java’.

unmounting samba partitions

Wednesday, November 15th, 2006

Sometimes the samba partitions become inaccessible and need to re-mount them. However the normal umount method does not work. Here is what you can do:

CODE:
  1. umount -l /path/to/samba

The -l option tells the umount utility to perform a lazy umount:

Detach the filesystem from the filesystem hierarchy now, and cleanup all references to the filesystem as soon as it is not busy anymore. (Requires kernel 2.4.11 or later.)