xen母机创建虚拟机n_如何复制Xen DomU虚拟机

xen母机创建虚拟机n

Assumption: There are VBD based Xen DomU virtual machines stored under /lhome/xen/vm-f11-sample/. There are two files under vm-f11-sample: vm0-f11.run (The configuration file) and vmdisk0 (The virtual disk). Now we want to duplicate the virtual machine vm0 stored under vm-f11-sample to vm-10.0.0.213 which is stored under vm-10.0.0.213. And vm-10.0.0.213’s ip will be 10.0.0.213. The steps to duplicate this virtual machine:

假设:在/ lhome / xen / vm-f11-sample /下存储了基于VBD的Xen DomU虚拟机。 vm-f11-sample下有两个文件vm0-f11.run (配置文件)和vmdisk0 (虚拟磁盘)。 现在,我们想复制下VM-F11样品存储到VM-10.0.0.213这是在VM-10.0.0.213存储虚拟机VM0。 vm-10.0.0.213的ip为10.0.0.213。 复制此虚拟机的步骤:

1)复制虚拟磁盘和配置文件 (1) Duplicate the virtual disk and configuration files)

# cp -rv vm-f11-sample vm-10.0.0.213

For security reason, the owner of the virtual machine’s files is root. So we need to copy these files as root. The destination directory is vm-10.0.0.213. And here we should make sure that vm0 is powered off. If vm0 is power on before this step, we need to shut it down first.

出于安全原因,虚拟机文件的所有者为root。 因此,我们需要将这些文件复制为root用户。 目标目录是vm-10.0.0.213。 在这里,我们应该确保vm0已关闭电源 。 如果在此步骤之前打开了vm0的电源,则需要先将其关闭。

2)更改文件名和配置文件 (2) Change the file names and the configuration file)

# cd vm-10.0.0.213
# mv vm0-f11.run vm.run
# vim vm.run

This is the content of vm.run:

这是vm.run的内容:

name="10.0.0.213"
memory=1024
disk = ['file:/lhome/xen/vm-10.0.0.213/vmdisk0,xvda,w' ]
vif = [ 'bridge=eth0' ]
bootloader = "/usr/bin/pygrub"
vcpus=2
on_reboot = 'restart'
on_crash = 'restart'

The name and disk entry are changed.

名称和磁盘条目已更改。

3)启动新的虚拟机并配置新的虚拟机 (3) Start the new virtual machine and configure the new virtual machine)

# xm create /lhome/xen/vm-10.0.0.213/vm.run
# xm console 10.0.0.213

After logging in vm-10.0.0.213, we can edit the network configuration file:

登录vm-10.0.0.213之后,我们可以编辑网络配置文件:

#  vi /etc/sysconfig/network-scripts/ifcfg-eth0

Change the IPADDR to 10.0.0.213. Then restart eth0:

将IPADDR更改为10.0.0.213。 然后重启eth0:

# ifdown eth0
# ifup eth0

Make sure this interface doesn’t have

确保此界面没有

HWADDR by commenting out the line that specify HWADDR if we use Xen bridge network. Log out of vm-10.0.0.213 and then use “Ctrl + ]” to exit the xm console. Reset vm-10.0.0.213 on Dom0:

HWADDR注释掉指定HWADDR如果我们使用Xen的桥接网络线 注销vm-10.0.0.213,然后使用“ Ctrl +]退出xm控制台。 在Dom0上重置vm-10.0.0.213:

# xm reset 10.0.0.213

The new virtual machine vm-10.0.0.213 is running now.

新的虚拟机vm-10.0.0.213现在正在运行。

翻译自: https://www.systutorials.com/how-to-duplicate-xen-domu-virtual-machines/

xen母机创建虚拟机n

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值