Showing posts with label Ubuntu Jaunty. Show all posts
Showing posts with label Ubuntu Jaunty. Show all posts

Wednesday, May 27, 2009

I need to backup my Ubuntu Jaunty

Recently purchased laptop was now somewhat out of order. I said somewhat because it is still working, but the fan is not running even when my CPU is very hot. Anyway, I suddenly needed to backup my entire installation of Ubuntu Jaunty for later recovery. So I came up with two options.

a. Copy all files and directories
b. Copy the image of a disk or logical partition

The first option is cool, if someone want to practice old style procedure using UNIX like commands in the open terminal. I could find instructions in “Linux Complete Backup and Recovery HOWTO” and “Howto: Backup and restore your system”.

However what I wanted was simple and easy tool to backup and restore my OS image in a snap! as with Ghost. Furthermore, I wanted to backup other OS or disk images such as the disk I assigned for Windows Vista and shared files between OS’s. That was the second option. I found three commonly used tools in Linux.

a. G4L (Ghost for Linux)
b. Partimage (Partition Image)
c. CloneZilla

Any one of these three tools looked promising to me. G4L has many options from copying only portion of file to network backup. CloneZilla looked perfect choice if I needed to clone Jaunty from central management server to many company-wide desktop as in Enterprise Desktop Management System. However, I chose Partimage because it seemed one of the most popular(G4L seemed also popular) and simplest in terms of menu and usage. Most of all, I install directly from Synaptic Package Manager without any adjustment.

After I selected my tool, I needed to make bootable version of Linux to be used at restore time. Most of the cloning tools have its own CD image for this purpose with small and light version of Linux. But I didn’t want to create CD because it’s just not as portable as my USB thumb drive which I carry most of the time. Even some Laptop does not comes with CD/DVD drive, right? So, I decided to created portable USB Linux for emergency. There might be several scenario to prepare emergency USB Linux.

1. Making Ghost like USB Linux from existing USB Linux.
If someone already have Debian compatible Linux on USB thumb drive, it is easy. After booting from USB Linux, invoking

sudo apt-get install partimage

command will make your thumb drive to be a Ghost like tool. (I also recommend you to install gparted.)

2. Creating new USB Linux using “USB Startup Disk Creator”
If you do not have USB Linux, and if you want to install same Ubuntu as you're using now, it is still easy. Using “USB Startup Disk Creator” in System/Administrator menu will solve your problem easily. Maybe you already used this tool, when you install Ubuntu to your Laptop without CD/DVD drive. All you need is ISO image of Ubuntu and USB drive with at most 2G. After you select source image and target USB disk, pressing “Make Startup Disk” will create USB Linux. All you need is reboot with the USB disk and install Partimage using command above.

From Better than nothing

3. Moving RescueCD to USB thumb drive
This option need several steps.
1) Download CD image
Another way to create Ghost like tool is using CD image provided by tool creator’s web site. Because I selected Partimage, I could download CD image called RescueCD from web site. (Or, just click RescueCD to download)

2) Create partition
Then I needed to make new partition to install Linux on my USB thumb drive. Because fdisk does not provide resize feature, and parted still does not accept creating ext3 type, I prefer gparted. And maybe, above all the reasons, nice GUI of gparted attracted me most. If you do not have gparted already, you can install it using following command.

sudo apt-get install gparted

There are options, though, when you create partition for USB Linux.

a.FAT32
b.ext2 or ext3

Most people choose FAT32 when creating a new partition for USB drive. Because it only use single allocation table in top of the file system rather than tree structured nodes, it usually seems more robust and safer for removable disk. However, it is quite inefficient when it comes with small sized files. So, I created ext3 type partition for my USB Linux with 250M in size. (because the size of image is around 234M). If you plan to use FAT32, you may need another 100M or more.

3) Mount CD image and USB drive
Once partition is ready, mount downloaded image and USB drive using following command.

sudo mount -t iso9660 -o loop=/dev/loop3 ./systemrescuecd-x86-1.1.7.iso ~/mnt1
sudo mount -t ext3 /dev/sdb2 ~/mnt2

4) Copy all files in CD image to USB drive
sudo cp -af ~/mnt1 ~/mnt2

5) Make USB Linux bootable
Because CD image comes with isolinux, which is boot loader for CD, more precisely ISO image, and because syslinux can only be used with FAT32 file system, I had to use Grub to make my USB Linux bootable.

grub-install --root-directory=/media/disk/ /dev/sdb2
(where /media/disk is mount folder and /dev/sdb2 is device for USB disk.)

Then, I was able to boot from USB Linux and to use Partimage.

4. Using DSL (Damn Small Linux)
Another Debian based Linux and one of the smallest is DSL. It only occupy 50M of disk space, but only comes with X. So, unless you are not going to use gparted which is partition tool of my choice, this might be another option. I believe that the preparation procedure is similar to what I described in 3. However, I love gparted and I want it to be installed in my USB Linux. So I did not tried this option.

From Better than nothing

Backup and restore using Partimage was really simple, once I booted from USB. After I started Partimage by typing "partimage" and pressed return, the above screen was shown. Then, I typed in the location where to store backup image after “image file to create/use,” and pressed F5. (Backup is default choice)

From Better than nothing

I kept the default options and pressed F5, then entered some comment. Finally, it started to backup my Jaunty. The result image was almost halt the original size. Restore from image is almost as simple as backup. After I entered image name and selected “Restore partition from image file” using TAB and arrow keys, I was able to recover Jaunty from stored image.

Finally you need to backup your partition table in safe place to prepare recovery from the lost of entire disk, not from single partition.

sfdisk -d /dev/hda > /media/disk/saved_partition_table

If you loose entire partition table, recover it from this file using following command.

sfdisk /dev/hda < /media/disk/saved_partition_table

You can find more information from "Partimage-manual Backup-partition-table."

Sunday, May 10, 2009

My laptop can access any files in my desktop

After I installed Linux on my laptop, I was able to connect and use any files in my desktop, just like old days with servers. Using SSH, Secure SHell which installed as default, I could connect to desktop and control my work from remote. However, for my laptop to accept connection, I installed openssh-server by typing

sudo apt-get install openssh-server

After that I need to alter configuration file to protect my desktop. By changing the file, /etc/ssh/sshd_config, I could block any other connection except from my laptop. For example, if I uncomment “ListenAddress” and assign only one IP address, I could block virtually all connection attempt from outside. And if I change “PermitRootLogin” to false and add only one user name in “AllowUsers,” I could permit only myself into desktop as non root account. Once I finish my configuration, I could connect my desktop by typing

ssh 192.168.2.1 -l username

After I looked for the path where my game file was located, I could copy the file into my laptop by typing

rcp username@192.168.2.1:/home/sweethome/Desktop/yofrankie_bge.zip .

from another terminal in my laptop. Then I decided to watch movie in my desktop folder from my laptop. Because I didn’t want to move movie file into my laptop, I mounted the folder in one of my local folder. To do that, I first installed Secure SHell File System, sshfs, by typing

sshfs username@192.168.2.1:/media/disk-1/ ~/mnt

Of course, I needed to create mount point ~/mnt before I mount. I also needed to synchronize some of my folder with my desktop. So I installed Unison both on my laptop and server by typing

apt-get install unison

Additionally, I installed GUI interface for my laptop by typing

apt-get install unison-gtk

After the installation, I ran Union client under “/Applications/Accessories" menu. When Unison ask me to enter root 1 and root 2 folders to sync, I entered one local folder

/home/laptop/memos

and one desktop folder name like this

ssh://username@192.168.2.1//home/username/memos


Then the GUI came up and I could synchronize memos. And I don't have to worry about sharing my folder any more.

More information can be found in following URL’s:
http://www.openssh.com/ (For Secure SHell)
http://fuse.sourceforge.net/sshfs.html (Secure SHell File System)
http://www.cis.upenn.edu/~bcpierce/unison/ (Unison)

Saturday, May 9, 2009

It’s nice to have Ubuntu Jaunty for my new laptop

My new laptop was finally arrived. Because of the recession, most laptops were selling in lower price than they’re expected in usual market. So, I got my new one in one third price of what I paid for the old one three years ago. Ever since I decided to quite my job to join CMU, I’ve gradually moved to open source and free softwares. As a result, I seldom boot into Windows system in these days. And finally, I decided to use Ubuntu as my main OS rather than Windows. Ironically, I used to use Windows as main OS and Linux as secondary or working environment while I worked for Unix company.

However, it was not as easy as Windows system to make my machine running. Thanks to new Jaunty, my work was reduced a lot. I wanted to record how I did to help others and myself.

1. Installation considerations
When I was working for the company, I used to divide a cluster of drives in logical partitions to make the system fast and extensible. Dividing consideration was usually i) which portion of system would need faster access, ii) which would be increasing most, iii) which would need to be replaced, iv) which parts would be simultaneously accessed, v) what’re the nature (OS core, DB, Log, File holder, etc), and so on.

So, the first thing to consider was dividing hard disk. To do that I asked myself, “what am I doing with laptop?” “What kinds of files that I’m going to hold with my laptop?” Well, most of the time, I make some program and write documents. From time to time, I watch movies, enjoy some music and collect some data. Usually with Ubuntu but sometimes with Windows.

Then I thought about what device I’m going to use with my laptop? Since I move mostly from Windows to Ubuntu, I need to support my Treo, iPod, as well as bluetooth mouse I use to use. Of course I need to take advantage of internal device of Dell Vostro 1330.

2. Installation
Most of installation is automated in Ubuntu just like Windows (or maybe simpler than Windows). The only thing I have to seriously consider during installation was partitioning. With the answers to my questions in mind, I decided to divide my hard drive into five parts.

a. Recovery (Dell allocated),
b. Windows OS, (shrink into half to share common and casual files)
c. Ubuntu 9.04, (at most 40G to hold only OS and open source software)
d. swap for Ubuntu (3G same as my laptop's memory)
e. Data (the rest for holding most of projects files and home folders under /home)

I divided Ubuntu into two / and /home to separate data from program because I didn’t want to be disturbed by the possible re-installation of Ubuntu in the future. So, I chose manual partitioning and first resize Windows partition. (Thanks to partman, I can safely resize Windows partition by just editing the size.) And created new partitions as I planned. It manual installation creating swap partition is necessary, and usually make same size as memory. (If needed, swap can be increased during operation using swap command like mkswap, swapon. However, unless I planned to use large program like Oracle DB, increase is seldom needed)

That’s all I need to do during installation.

3. Bluetooth
a. Microsoft Notebook Mouse 5000
Because of small touch pad, I really wanted to use mouse as soon as possible. Fortunately, I could see bluetooth symbol in the panel. That means I don’t have to worry about adding bluetooth stack into kernel. So, I was ready to pair my devices.

From Better than nothing
I first clicked bluetooth symbol and select “Setup new device.” After wizard dialog appeared, I moved into “Device Search” section by pressing “Forward.” Either I choose "Automatic” or "Use Fixed PIN Code" with 0000, in this section, pairing result said successful. However, the LED in MS Mouse was still blinking. Meaning MS Mouse was not paired, yet. I found answer in a corner of forum somewhere in launchpad. After some struggling, I found correct procedure.

First, I needed to install bluez-compat package with command;

sudo apt-get install bluez-compat

Then turn off and on MS Mouse. Again make mouse into pairing mode by pressing small button in bottom. When I saw LED blinking, type

hidd –search


then the LED of mouse was gone, means that you are finally paired. The mouse keep paired even after reboot or resumed.

b. The Treo755p.
The next challenge was smart phone, Palm Treo755p. I said challenge because I suffered enough last I tried with my desktop. However, this time, I was actually surprised to see that new gnome-pilot was supporting bluetooth. I used to follow guide like “Palm Bluetooth How-to to make my Treo to sync with Evolution. It was much easier now in Jaunty, Ubuntu 9.04. My procedure was simple.

First, pair palm and laptop. As before, just followed wizard after pressing bluetooth symbol in pannel. This time I needed to use “Fixed PIN code” and my PIN number to pair with Treo.

From Better than nothing
Next, I launched gnome_pilot by choosing the menu, System\Preference\Palm OS Device, and followed the wizard. Some errors came but ignored the message and follow the instruction, except selecting bluetooth as communication device. That’s it. Now I was able to sync with Evolution through bluetooth. I selected usual conduits to sync with contact, calendar, menu and todo data in Evolution.

c. iPod.
I chose Banshee to manage my music in iPod. It looked that Songbird was still unstable somehow, and Amarok asked me to install KDE libraries. After the installation, everything works fine, except album photos. It was not a big deal to me now, so I moved on to the next.