Friday, August 28, 2009

Comparing 2 files

Better than opening in 2 VIM windows , I used to take diff and open its output in vim :).
But diff itself has flag which will compare files line by line.


diff -ay file1 file2 | less

Friday, August 21, 2009

Creating your own file/web host

Pretty easy.

yum install httpd
ln -s /directory_to_share /var/www/directory_to_share
chmod 777 /directory_to_share
service httpd restart


i take drastic approach when it come to directories.:)

Wednesday, August 19, 2009

Connecting to windows machine from linux machine

By default Linux has "rdesktop" program.
Problem will rise on windows machine(of course!!).

1.Go in Start -> Control Panel -> Windows firewall.
2.Goto "Exceptions" tab.
3.Check "Remote Desktop" entry.
4.Press OK.

5.Open System Properties menu (Computers -> Right Click -> Properties)
6.Goto Remote tab
7.In Remote Desktop menu, check "Allow users to connect remotely to this computer"
8.Press OK.

Other variants with similar setting are tsclient on Linux(which is for both VNC and rdesktop),vncviewer(again by default in Linux ,but need VNC on windows machine)

Monday, August 10, 2009

KVM live migration

You can refer to my previous post for setting up KVM.

Before :

[root@euclid ~]# virsh list
Id Name State
----------------------------------
4 veuler running

[root@gauss ~]# virsh list
Id Name State
----------------------------------



Migration Command :

[root@euclid ~]# virsh migrate --live veuler qemu+ssh://gauss/system
root@gauss's password: *****


After :

[root@euclid ~]# virsh list
Id Name State
----------------------------------

[root@gauss ~]# virsh list
Id Name State
----------------------------------
4 veuler running



QEMU Vs KVM :

QEMU provides virtualization purely by means of software, and can be used as a stand-alone package.

KVM--which stands for "Kernel-based Virtual Machine"--provides for hardware-assisted virtualization. It can only be used with newer processors, such as Intel Core 2's or more recent AMD Athlon64's. It must be used in conjunction with QEMU.

Thursday, August 6, 2009

Opening qcow files

Qcow files are used as disks in KVM

losetup -f

Get a free loop-back device, say /dev/loop0.

losetup /dev/loop0 harshal.qcow
kaprtx -av /dev/loop0
vgscan


Get the name of the volume group in qcow file, say vg_harshal.

vgchange -ay vg_harshal

Enable that volumegroup.

lvdisplay

Get logical volume name for that volume group, say /dev/vg_harshal/root1

mount /dev/vg_harshal/root1 /mount_point

Good to Use.

Once done, we need to undo the changes.


umount /mount_point
vgchange -an vg_harshal
kpartx -dv /dev/loop0
losetup -d /dev/loop0