Tuesday, September 20, 2011

Error: Device (vbd) could not be connected /etc/xen/scripts/block failed error detected

You may get this error while starting a xen vps


[root@test ~]# xm create /home/xen/vm854/vm854.cfg
Using config file "/home/xen/vm854/vm854.cfg".
Error: Device 5632 (vbd) could not be connected. /etc/xen/scripts/block failed; error detected.

Check the hotplug log

[root@test ~]# tail /var/log/xen/xen-hotplug.log
xenstore-read: couldn't read path backend/vbd/176/5632/node
Nothing to flush.
losetup: could not find any free loop device
xenstore-read: couldn't read path backend/vbd/177/5632/node
Nothing to flush.
losetup: could not find any free loop device
xenstore-read: couldn't read path backend/vbd/178/5632/node
losetup: could not find any free loop device
Nothing to flush.
xenstore-read: couldn't read path backend/vbd/179/5632/node

See the reason
losetup: could not find any free loop device


it says there is no free loop back devices. Your vps might be at present mounted with a cd-rom. but as there is no free loop device it cant mount it and start vps. Unmount the cdrom and start the vps again. It will work.

Monday, September 19, 2011

changing the RAM of Domain-0 in xen

This post explains how to set or change Domain-0 RAM allocation. This is a dynamic method so I'm not sure it will survive reboot.

Current usage

[root@test ~]# xm list
Name                                      ID Mem(MiB) VCPUs State   Time(s)
Domain-0                                   0    19002     8 r----- 331242.1
vm649                                     27     1007     2 r-----  81706.6
vm652                                     20     2007     2 -b---- 156137.8
vm770                                     26     2007     2 r----- 230305.3

Now setting the Domain-0 RAM to 4GB

[root@test ~]# xm mem-set 0 4096

After changing the RAM of Domain-0

[root@test ~]# xm list
Name                                      ID Mem(MiB) VCPUs State   Time(s)
Domain-0                                   0     4096     8 r----- 331416.8
vm649                                     27     1007     2 r-----  82261.6
vm652                                     20     2007     2 -b---- 156240.8
vm770                                     26     2007     2 r----- 230515.7
[root@test ~]#

There is also another method which edits grub.conf
#vi /etc/grub.conf

title CentOS (2.6.18-238.19.1.el5xen)
        root (hd0,0)
        kernel /boot/xen.gz-2.6.18-238.19.1.el5 dom0_mem=4096
        module /boot/vmlinuz-2.6.18-238.19.1.el5xen ro root=LABEL=/ rhgb quiet
        module /boot/initrd-2.6.18-238.19.1.el5xen.img
It needs rebooting the system

clearing arp cache in linux

Address Resolution Protocol (also known as ARP) is one of the effective ways for searching the address of a host’s hardware(Ethernet). Sometimes wrong arp cache will make problems. You can clear all arp cache using following commands.

how to see current arp cache
root@cpaneltest [~]# arp -n
Address HWtype HWaddress Flags Mask Iface
192.168.1.1 ether 00:25:5E:1F:7A:BE C eth0
192.168.1.2 ether 6C:F0:49:C5:BF:6A C eth0
192.168.1.4 ether 6C:F0:49:C5:BF:26 C eth0
root@cpaneltest [~]#

Clearing arp cache with verbose
root@cpaneltest [~]# ip -s -s neigh flush all
192.168.1.1 dev eth0 lladdr 00:25:5e:1f:7a:be ref 17 used 28/27/81 REACHABLE
192.168.1.2 dev eth0 lladdr 6c:f0:49:c5:bf:6a ref 2 used 64/64/20 STALE
192.168.1.4 dev eth0 lladdr 6c:f0:49:c5:bf:26 ref 4 used 92/3/0 REACHABLE

*** Round 1, deleting 3 entries ***
*** Flush is complete after 1 round ***

current entries
root@cpaneltest [~]# arp -n
Address HWtype HWaddress Flags Mask Iface
192.168.1.1 (incomplete) eth0
192.168.1.2 (incomplete) eth0
192.168.1.4 ether 6C:F0:49:C5:BF:26 C eth0
root@cpaneltest [~]#

You can also delete particular arp entries using following command
root@cpaneltest [~]# arp -d 192.168.1.1
root@cpaneltest [~]# arp -d 192.168.1.2

Adding a static arp entry
root@cpaneltest [~]# arp -s 192.168.1.10 00:00:93:12:04:57

This will answer ARP requests for 10.0.0.2 on eth0 with the MAC address for eth1.
 #arp -i eth0 -Ds 10.0.0.2 eth1 pub

Delete the ARP table entry for 10.0.0.1 on interface eth1. This will match published proxy ARP entries and permanent entries.
#arp -i eth1 -d 10.0.0.1


Recommended Reading

1. Practical Guide to Linux Commands, Editors, and Shell Programming, A (2nd Edition)
2. Understanding the Linux Virtual Memory Manager
3. UNIX and Linux System Administration Handbook (4th Edition)