新建一块6G的设备作为XEN的磁盘
dd if=/dev/zero of=/vmserver/disk_1.img bs=1M count=6000
查看相关权限并设置相同权限
ll /vmserver/
chmod 755 disk_1.img
更改下面配置前需先关闭虚拟机,试验时,有一虚拟机未关闭加入下面选项导致不能开启
[root@Centos ~]#vi /etc/xen/VM_3
disk = [ "tap:aio:/vmserver/VM_3,xvda,w","tap:aio:/vmserver/disk_1.img,xvdb,w" ]
启动虚拟机后,fdisk -l查看新加入的虚拟机的硬盘
然后进行分区和格式 fdisk /dev/xvdb
mkfs.ext3 /dev/xvdb1
mount /dev/xvdb1
/da
设置自动挂载新硬盘 vi /etc/fstab
/dev/xvdb1
/da
有些主板在启动后会出现如下错误信息提示,现象描述为xen跟主系统争用pci资源导致
Feb 9 12:51:43 a211-155-229-83 kernel: PCI: BIOS Bug: MCFG area at e0000000 is not E820-reserved
Feb 9 12:51:43 a211-155-229-83 kernel: PCI: Not using MMCONFIG.
[root@a211-155-229-83 ~]# dmesg |grep BIOS
BIOS-provided physical RAM map:
PCI: BIOS Bug: MCFG area at e0000000 is not E820-reserved
方法更改/etc/grub.conf 在 module /vmlinuz-2.6.18-128.el5xen ro root=LABEL=/ 加入 pci=nommconf不让其检测
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-128.el5xen)
root (hd0,0)
kernel /xen.gz-2.6.18-128.el5
module /vmlinuz-2.6.18-128.el5xen pci=nommconf ro root=LABEL=/
module /initrd-2.6.18-128.el5xen.img
title CentOS (2.6.18-128.el5PAE)
root (hd0,0)
kernel /vmlinuz-2.6.18-128.el5PAE ro root=LABEL=/
initrd /initrd-2.6.18-128.el5PAE.img
XEN有时常常出现
xenconsole: Could not open tty `/dev/pts/0': No such file or directory
错误,解决办法重启xend进程 service xend restart
[root@a211-155-229-83 ~]# xm console xen_vm1
xenconsole: Could not open tty `/dev/pts/0': No such file or directory