Wednesday, November 21, 2007

Mounting LVM Disk using Ubuntu livecd

Mounting is an easy process to do, provided the filesystem type you are using is supported. What happen when you have an LVM formatted disk, and you need to mount it because the disk cannot be booted and a hell lot of valuable data kept inside?? Do not worry, because the solution is here.......

1. Get a live cd, for example, Ubuntu. For this article, I use Ubuntu 6.06 (I cannot find any latest version of ubuntu at my place)

2. Boot using the live cd. Search for these tools: lvm2. If the cd do not have it, install it.
# apt-get install lvm2

3. To make sure the harddisk is recognised, you can use fdisk
# fdisk -lu

4. Once installed, run pvscan to scan all disks for physical volume. this to make sure your LVM harddisk is detected by Ubuntu
# pvscan
PV /dev/sda2 VG VolGroup00 lvm2 [74.41 GB / 32.00 MB free]
Total: 1 [74.41 GB] / in use: 1 [74.41 GB] / in no VG: 0 [0 ]


5. After that run vgscan to scan disks for volume groups.
# vgscan
Reading all physical volumes. This may take a while...
Found volume group "VolGroup00" using metadata type lvm2


6. Activate all volume groups available.
# vgchange -a y
2 logical volume(s) in volume group "VolGroup00" now active

7. Run lvscan to scan all disks for logical volume. You can see partitions inside the hard disk now active.
# lvscan
ACTIVE '/dev/VolGroup00/LogVol00' [72.44 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol01' [1.94 GB] inherit

8. Mount the partition to any directory you want, usually to /mnt
# mount /dev/VolGroup00/LogVol00 /mnt

9. You can access the partition in the /mnt directory and can backup your data

Sunday, November 11, 2007

Combining multiple network interface into single interface (bond)

Bonding is a process of combining more multiple network interfaces as one interface. The main objective of bonding is to improve the performance of both network interface. Using this way, more load and data can be handled by the bonded network interface rather than using single network interface. In this how to, I will use only two interfaces as example.

1. Create bond configuration file (example bond0)
# vim /etc/sysconfig/network-scripts/ifcfg-bond0

2. Put below configuration inside the bond0 configuration file
DEVICE=bond0
IPADDR=192.168.1.20
NETWORK=192.168.1.0
NETMASK=255.255.255.0
USERCTL=no
BOOTPROTO=none
ONBOOT=yes

Replace above ip address, network and netmask with actual details and save the configuration file

3. Open the first network interface configuration file
# vim /etc/sysconfig/network-scripts/ifcfg-eth0

4. Append with the below details and save
DEVICE=eth0
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none

5. Open the second network interface configuration file
# vim /etc/sysconfig/network-scripts/ifcfg-eth1

6. Edit the file to become like below and save
DEVICE=eth1
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none

7. Load bond module
# vim /etc/modprobe.conf

8. Append below details and save
alias bond0 bonding
options bond0 mode=balance-alb miimon=100

9. Load the bonding module
# modprobe bonding

10. Restart network
# /etc/init.d/network restart

11. You can check whether your bonding is ok by using ifconfig command
# ifconfig

The output should be something like below

bond0     Link encap:Ethernet  HWaddr 00:0C:29:C6:BE:59
inet addr:192.168.1.20 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:2804 errors:0 dropped:0 overruns:0 frame:0
TX packets:1879 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:250825 (244.9 KiB) TX bytes:244683 (238.9 KiB)

eth0 Link encap:Ethernet HWaddr 00:0C:29:C6:BE:59
inet addr:192.168.1.20 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fec6:be59/64 Scope:Link
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:2809 errors:0 dropped:0 overruns:0 frame:0
TX packets:1390 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:251161 (245.2 KiB) TX bytes:180289 (176.0 KiB)
Interrupt:11 Base address:0x1400

eth1 Link encap:Ethernet HWaddr 00:0C:29:C6:BE:59
inet addr:192.168.1.20 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fec6:be59/64 Scope:Link
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:502 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:258 (258.0 b) TX bytes:66516 (64.9 KiB)
Interrupt:10 Base address:0x1480

Monday, November 5, 2007

Installing wireless on fedora 7 IBM Thinkpad r60 machine

You just bought a new laptop, IBM Thinkpad R60. Since you are an open source fans, you have decided to install the latest stable version of fedora, the fedora 7. After finish installing operating system, you try to access your office's wireless internet connection. but to your surprise there is no wireless options can you find on the start up menu. Don't panic, because there is a way how to configure your new laptop so that it can access wireless internet connection.

1. Check your wireless adapter.
$ cat /etc/sysconfig/hwconf | grep -i wireless
or
$ kudzu -p | grep -i wireless

2. The outcome usually will be like this: desc: "Intel Corporation 3945ABG Network Connection"
If your outcome of the command is also similar to the above, then you are in the right place :-).

3. The driver of that wireless device is not pre-installed on Fedora 7. So you have to install the driver from additional repository. Access you machine as root, and create file /etc/yum.repos.d/atrpms.repo
$ vim /etc/yum.repos.d/atrpms.repo
Insert the following content in the atrpms.repo
[atrpms]
name=Fedora Core $releasever - $basearch - ATrpms
baseurl=http://dl.atrpms.net/fc$releasever-$basearch/atrpms/stable
gpgkey=http://ATrpms.net/RPM-GPG-KEY.atrpms
gpgcheck=1

Import also the atrpms signing key
rpm --import http://ATrpms.net/RPM-GPG-KEY.atrpms

4. Install ipw3945 driver.
$ yum install ipw3945

5. You have to start the daemon in order for the driver to work. Add /sbin/ipw3945d to your /etc/rc.local
$ echo "/usr/sbin/ipw3945d" >> /etc/rc.local

6. Restart your machine.

7. You can also activate a service named NetworkManager to easily choose from GUI the wireless connection that you desire.
$ NetworkManager
$ chkconfig NetworkManager on - This command set NetworkManager to start on boot

8. You can scan for wireless network around you by using the below command
$ iwlist scan