• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
sharadchhetri

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

Xen Virtual Machine Migration (In Hyper-VM)

January 22, 2011 by Sharad Chhetri Leave a Comment

In this post, we will learn about how to do Xen Virtual Machine migration from one Host Base Machine to other. We hope you know how to create a Virtual Machine in Xen.

Our both host machines had the same specs and same LVM management.
Here LVM Management means in both host machine we have same no. of Hard Disk and allotment of Physical Volume was same.

Now in this scenario we want to migrate our Virtual Machine from Xen02 to Xen01.
The following are details below —

Details of Lab environment
(1) Xen Server 1 = xen01
(2) Xen Server 2 = xen02
(3) Using LVM = yes
(3) Virtual Machine Name = redtest created at xen02
(4) Migrate Virtual Machine from xen02 to xen01 ( xen02—-> xen01 )

Roadmap of this task

In this section we will discuss about the roadmap which we will follow for this migration.

(1) Make snapshot of LVM partition which you have given to you virtual Machine.

On running the command /usr/sbin/lvdisplay we found our VM was resided at /dev/xen_disks/redtest-sda

--- Logical volume ---
LV Name /dev/xen_disks/redtest-sda
VG Name xen_disks
LV UUID dLa1Uz-qnI2-oL50-vSgH-YZ1q-vgM3-fc0IpF
LV Write Access read/write
LV Status available
# open 0
LV Size 10.00 GB
Current LE 2560
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:7

(2) Create image of snapshot by “dd” command and transfer it to xen01

(3) Create same size of LVM in xen01 as you have in xen02

(4) Transfer the VM file from xen02 to xen01 ( eg. /etc/xen/redtest )

(5) Restore the snapshot image in xen01

(6) Remove the snapshot image,LVM and Xen VM file from xen02 after successfully finishing the task.

Steps to follow Xen VM migration from Xen02 to Xen01

In this section we will walk you through how we did the Xen VM migration.

(1) Login into xen02 where your Virtual Machine is present.
On doing “xm list” you will see the list of Virtual machine in xen server.

/usr/sbin/xm list

(2) Shutdown the Virtual Machine by ” init 0 ” command after login into xen02.

Alternatively from base Xen server machine you can shutdown the VM without login into VM.
The command is –

#(redtest is VM name ,see it from "xm list")
/usr/sbin/xm shutdown DomainName 

(3) After shutdown, take the snapshot of LVM partition where you have your VM is installed.

/usr/sbin/lvcreate -s -L 500M -n redtest-snap /dev/xen_disks/redtest-sda

(4) Make the snapshot image :

dd if=/dev/xen_disks/redtest-snap of=redtest.img bs=4096

(5) Transfer the image file to xen01.

scp redtest.img xen01:/root

(6)Login ino Xen01 and create the same size of LVM with same name:

/usr/sbin/lvcreate -n redtest-sda --size 10G xen_disks

(7) Restore the image file –

cd /root
dd if=redtest.img of=/dev/xen_disks/redtest-sda bs=4096

(8) If you will do “xm list” you will not find your VM name in list.

Start the VM in Xen01. In our xen server we have command to start VM is xm create domain-name
Hence,

/usr/sbin/xm create redtest

Note: May be in your Xen server the command is “xm start Domain-name”

(9) After successful migration remove the snapshot,imagefile,LVM from xen02 according to your need.

Share this:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. Xen Server License Nagios Plugin (bash script)
  2. Virtual Machine inaccessible status on VirtualBox 4.3
  3. Create single node Virtual Machine with Vagrant
  4. Create multiple virtual machine with one Vagrantfile
  5. Sharing server Migration from CentOS 6 to CentOS 7
  6. hash:/etc/postfix/virtual is unavailable. open database /etc/postfix/virtual.db: No such file or directory
  7. Enable ethernet in RHEL 6.0 and CentOS 6.0 : Tested In Virtual Box and VMware
  8. How to configure ethernet in CentOS 6 after installing in Virtual Box
  9. How to configure vsftpd server with virtual user mysql authentication in CentOS 6
  10. How to install linux operating system in remote machine with telnet

Filed Under: Linux Tagged With: xen

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Linux Command

What is Linux Internal And External Command

Linux Basic Commands With Examples For Every Beginner

tr command to convert lines to space , tab and vertical tab

smbpasswd command not found on CentOS 7 and RHEL 7

Solution : semanage command not found

Unix / Linux : How to print duplicate lines from file

More Posts from this Category

You Might Like These Articles!

simplecodesyntax wordpress plugin

SimpleCodeSyntax : My Another WordPress Plugin

Install Nginx

How To Install Nginx On Ubuntu 22.04 LTS

Install Latest Git package in Ubuntu Operating System

How To Always Install Latest Git Package In Ubuntu Operating System

Bash script for installing VirtualBox on Ubuntu 22.04 LTS Desktop

Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

libfuse

dlopen(): error loading libfuse.so.2 – Got Error On Ubuntu

Failed to open/create the internal network

VirtualBox Error: Failed to open/create the internal network

Always Useful Tips And Tricks

How to configure ethernet in CentOS 6 after installing in Virtual Box

Keep logs of user after sudo su – : Secondary Logging

Edit the crontab without using crontab -e

New XAMPP security concept

How to install korn shell ksh in Linux

Terminal Recording with script and scriptreplay command

Nagios HTTP WARNING: HTTP/1.1 403 Forbidden

Explore 90+ Article On "Linux Tips And Tricks"

Copyright © 2023 ยท
The material in this site cannot be republished either online or offline, without our permission.
Proudly Blogging From Bharat.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy