migrating a LVM based xen domU to a file based image

1) shut down the domU
2) from the dom0, mount the LVM volume:

% /dev/vg0/web.isber /mnt/web.isber

3) use dd to convert the LVM volume to an image file

% [vm2:~]# dd if=/dev/mapper/vg0-web.isber of=/lots-of-storage/web.isber-disk.img

4) you can now copy or move this .img file to another xen dom0 and boot using:

--/etc/xen/hostname.cfg--
#
#  Disk device(s).
#
root        = '/dev/hda1 ro'
disk        = [
                  'tap:aio:/var/xen/images/domains/web.isber/swap.img,hda2,w',
                  'tap:aio:/var/xen/images/web-disk.img,hda1,w',
              ]
--/etc/xen/hostname.cfg--

migrating a cacti installation to a new platform

when you migrate cacti to a new machine if the platform is different then your .rrd files will no longer work. the workaround is to export all of the .rrd files to .xml on the source host and then convert back from .xml to .rrd on the source host.

script to convert all .rrd files to .xml:

#!/bin/bash
###### 20080915
#####
#### export .rrd to .xml
###
##

cactipath='/var/lib/cacti/rra'
files=$(ls $cactipath| grep .rrd | cut -d "." -f 1 )
for i in $files; do
    rrdtool dump "$cactipath/$i.rrd" "$cactipath/$i.xml"
    echo "$i.xml $cactipath/$i.rrd exported"
done

script to convert all .xml files to .rrd:

#!/bin/bash
###### 20080915
#####
#### import .xml to .rrd
###
##

cactipath='/var/lib/cacti/rra'
files=$(ls $cactipath| grep .rrd | cut -d "." -f 1 )
for i in $files; do
    rrdtool restore "$cactipath/$i.xml" "$cactipath/$i.rrd"
    echo "$i.xml imported"
done

Powered by WordPress | Designed by Elegant Themes