Pages

Showing posts with label xen. Show all posts
Showing posts with label xen. Show all posts

Monday, May 23, 2011

Fixing Time Sync problem in Xen DOMU on Oracle VM Server

A 0 in the following suggests syncing time with DOM0:
/proc/sys/xen/independent_wallclock

However, when DOMU is unable to keep time sync with DOM0, the following may be tried:
echo 1 > /proc/sys/xen/independent_wallclock

If you have a ntpd setup elsewhere:
/usr/sbin/ntpdate <ntpd_server>

To update over the network:
rdate -s http://time-a.nist.gov

To manually set the date:
date -s "<date>

Sunday, May 22, 2011

Editing Xen System.img

This post is useful when you want to change system configuration files of a stopped guest VM without botting up the guest first. This method can be used especially when your guest VM crashes or hangs during boot up due to a configuration error.


The following steps have been tested on Xen 4 and Oracle VM 2.2 as well for a Linux guest VM. From DOM0: 


Check FS Type
fdisk -u -l System.img

If FS type is ext3, you can directly mount a partition using lomount, otherwise follow the mounting LV's steps.

Mount Ext3 Partitions

Linux system.img with ext3 partitions can be mounted as:
lomount -diskimage System.img -partition 2 /mnt

Mounting LV's

# Mounting guest's root partition locally
# Find a free loop device
loop_dev=`losetup -f`

# Now bind the image file to that loop device
losetup ${loop_dev} System.img

# Next, scan the loop device for partitions
kpartx -av ${loop_dev}

# If /dev/mapper doesn't list LVs for the partitions from kpartx, find LV:
vgscan
vgchange -ay sysvg

# Mount the desired LVM
mount /dev/mapper/loop0p2 /mnt

LVs UnMounting
# After editing in /mnt, unmount and remove partitions:
umount /mnt

# Disable the LV
vgchange -an /dev/mapper/loop0p2

# Remove the discovered partitions
kpartx -dv ${loop_dev}

# Delete the loop device
losetup -d ${loop_dev}