preload
Feb 05

Here is script howto mount guest VM to control domain VM. If you want to make file backups from snapshot or like in my case, configure new vm ( ip address etc ) one can easily modify it.

#!/bin/bash
# contact@mceith.com 2011

if [ ! -n "$1" -o ! -n "$2" -o ! -n "$3" ]; then
  echo "Usage: $0 <target vm uuid> <control domain uuid> mount|umount"
  exit 1
fi

case "$3" in
mount)
if [ -f /tmp/tmpvbd ]; then
  echo "VBD allready exists!"
  exit 1
fi

# Get uuid of vm you want to configure
VMUUID=`xe vbd-list vm-uuid=$1 params=vdi-uuid empty=false --minimal`

# Create VBD link to VM VDI on dom0
NEWVM=`xe vbd-create vm-uuid=$2 vdi-uuid=$VMUUID device=1`

# Plug it to dom0
xe vbd-plug uuid=$NEWVM

VM_VDEV=`xe vbd-list uuid=$NEWVM params=device --minimal`1

# Lag
sleep 1

# Mount it
mount /dev/$VM_VDEV /mnt/newvm

echo $NEWVM &gt; /tmp/tmpvbd
# Do what ever you like
# ....
;;

umount)

if [ ! -f /tmp/tmpvbd ]; then
  echo "No VBDs mounted?"
  exit 1
fi

umount /mnt/newvm

NEWVM=`cat /tmp/tmpvbd`

# Unplug
xe vbd-unplug uuid=$NEWVM

xe vbd-destroy uuid=$NEWVM

rm -f /tmp/tmpvbd
;;
esac

exit $?
Dec 18

One can manage Dell server with DRAC ( Dell Remote Access Controller ) via ssh session. iDRAC6 is little bit different than version 5. Here are the commands to access console and reboot / shutdown the server.

Connect:


$ ssh 192.168.1.19 -l root
root@192.168.1.19's password:
/admin1->

Access the console:


/admin1-> console com2

With DRAC5 one had to type:


Dell Remote Access Controller 5 (DRAC 5)
Firmware Version 1.20 (Build 07.03.02)

$ connect com2

To reboot the server type reset:


/admin1-> cd /system1
/admin1/system1
/admin1/system1-> reset

stop stands for poweroff and start for powerup.

In DRAC5 to use power functions one must first start SM CLP:


$ smclp
DRAC5 SM-CLP System Management Shell, version 1.0
Copyright (c) 2004-2007 Dell, Inc.
All Rights Reserved

I noticed that people end up this site with pattern “ssh reset drac”. If you are wondering how that is done, here it is:

ssh root@drac-ip
racadm racreset

This will reboot the DRAC if the web manage etc has crashed.

Nov 28

You can add more space to Xen storage repository. In this example I use local lvm storage repository.

Find the  one you want to resize:

[root@xen ~]# xe vdi-list name-label=Pool\ Metadata\ Backup sr-name-label=Local\ storage
uuid ( RO)                : c73d9724-a284-4caa-9da9-167a8b8b9389
name-label ( RW): Pool Metadata Backup
name-description ( RW):
sr-uuid ( RO): 243a9532-0a89-d406-d813-855a0350ebeb
virtual-size ( RO): 262144000
sharable ( RO): false
read-only ( RO): false

Resize the VDI:

[root@xen ~]# xe vdi-resize uuid=c73d9724-a284-4caa-9da9-167a8b8b9389 disk-size=524288000

See that the size has changed:

[root@xen ~]# xe vdi-list name-label=Pool\ Metadata\ Backup sr-name-label=Local\ storage
uuid ( RO)                : c73d9724-a284-4caa-9da9-167a8b8b9389
name-label ( RW): Pool Metadata Backup
name-description ( RW):
sr-uuid ( RO): 243a9532-0a89-d406-d813-855a0350ebeb
virtual-size ( RO): 524288000
sharable ( RO): false
read-only ( RO): false

Mount it:

[root@xen ~]# xe-backup-metadata -d -u 243a9532-0a89-d406-d813-855a0350ebeb
Using SR: Local storage
Mounted backup VDI on: /var/run/pool-backup-c73d9724-a284-4caa-9da9-167a8b8b9389
Press ^D to exit shell and safely detach it.

Verify it:

[root@xen ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             3.8G  2.2G  1.5G  61% /
none                  376M     0  376M   0% /dev/shm
/dev/xvda             243M  6.8M  223M   3% /var/run/pool-backup-c73d9724-a284-4caa-9da9-167a8b8b9389

Resize it:

[root@xen ~]# resize2fs /dev/xvda
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/xvda is mounted on /var/run/pool-backup-c73d9724-a284-4caa-9da9-167a8b8b9389; on-line resizing required
Performing an on-line resize of /dev/xvda to 512000 (1k) blocks.
The filesystem on /dev/xvda is now 512000 blocks long.

And you are done:

[root@xen ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             3.8G  2.2G  1.5G  61% /
none                  376M     0  376M   0% /dev/shm
/dev/xvda             485M  7.1M  453M   2% /var/run/pool-backup-c73d9724-a284-4caa-9da9-167a8b8b9389