#create a snapshot of the LV drive
/usr/sbin/lvcreate -L5G -s -n vm_test_snap /dev/VolGroup00/vm_test
#turn the snapshop into a file image
dd if=/dev/VolGroup00/vm_test_snap | gzip -9 >/backup/vm_test.dd.gz
#remove the snapshot
/usr/sbin/lvremove /dev/VolGroup00/vm_test_snap
#move the file image
#copy and modify the Xen config file
cp /etc/xen/test /etc/zen/test2
vi /etc/zen/test2 #change the name of the LV drive to vm_test2
#uncompress the file image into a LV drive
/usr/sbin/lvcreate -n vm_test2 --size 5G VolGroup00
gzip -dc /backup/vm_test.dd.gz | dd of=/dev/VolGroup00/vm_test2
#start the new VM
/usr/sbin/xm create -c test2
Progress can be monitored like this:
#First, find out the process id of the dd process by running the following in the new virtual terminal. $ pgrep -l '^dd$' #To send the USR1 signal to the dd prcoess: $ kill -USR1 8789 #it will print its status to stderr
To do a raw disk image, run
dd if=/dev/sda of=/dev/hda bs=16384 conv=notrunc,noerror