首页 > xen > xen半虚拟化pygrub使用更方便

xen半虚拟化pygrub使用更方便

2010年1月22日 eric 发表评论 阅读评论

在使用XEN的时候,因为编译DomU内核时,他默认很多模块都没有,所以安装服务的时候,需要在从新编译DomU内核,再这个时候,你不可能把所有的虚拟机都down掉,更新完内核在一起启动虚拟机吧。这个时候我发现官方的文档 pygrub 可以实现,虚拟grub 去读取 虚拟机里的配置文件,这样每台虚拟机器与每台虚拟机的内核可以是不一样的了,但是记住,一定要支持XEN不然一样会报错,好了不多说废话了。

环境:

xen version : 3.4.2

Dom0 : ubuntu-server 8.0.4

DomU: ubuntu-server-8.0.4

操作:

1.复制内核到虚拟机,如果你的虚拟机是开着,就可以通过网络,你也可以关闭虚拟机器,mount挂载方式,下面我通过挂载方式。

shell$> mount -o loop  /ubuntu/ubuntu.img /mnt

shell$>cp /boot/vmlinuz-2.6.18.8-xenU /mnt/boot

shell$>cp /boot/initrd.img-2.6.18.8-xenU /mnt/boot

2.在虚拟机文件系统里 创建 grub启动配置文件。

shell $> cd /mnt/boot

##创建 grub文件夹

shell$>mkdir grub

##创建配置文件因为我的是ubuntu所以我的是menu.lst

shell$>vim menu.lst

default         0
timeout         3
title           nginx
root            (hd0,0)
kernel          /boot/vmlinuz-2.6.18.8-xenU console=tty1 root=/dev/sda1 ro
initrd          /boot/initrd.img-2.6.18.8-xenU
quiet
##创建完毕后保存退出

3.创建虚拟机pygrub启动配置文件。

shell $> cd  /opt/xenconf

shell $> vim ubunt.cfg

bootloader = “/usr/bin/pygrub”
memory = 512
name = “nginx”
disk = ['file:/ubuntu/ubuntu.img,sda1,w','file:/ubuntu/swap.img,sda2,w']
root = “/dev/sda1 ro”
vif = ['']
on_poweroff = ‘destroy’
on_reboot   = ‘restart’
on_crash    = ‘restart’
vcpus       = ’2′
extra = ‘xencons=tty1′

4.启动虚拟机

shell $>xm create mdt.cfg -c

xe

 

好了,呵呵,大家快试试!!

转载请注明:文章转载自:Eric's linux and nginx! (http://www.nginxs.com)
本文地址:http://www.nginxs.com/linux/24.html

分类: xen 标签: , , , ,
  1. 2017年11月11日16:51 | #1

    Are you currently currently serious about anyone
    you care about?

  2. 2017年11月12日01:01 | #2

    Today, I went to the beach front with my children.
    I found a sea shell and gave it to my 4 year old
    daughter and said “You can hear the ocean if you put this to your ear.”
    She put the shell to her ear and screamed. There was a hermit
    crab inside and it pinched her ear. She never wants to go
    back! LoL I know this is entirely off topic but I had to tell someone!

  3. 2017年11月12日01:22 | #3

    Hi there everyone, it’s my first pay a quick visit at this web site, and post
    is genuinely fruitful for me, keep up posting these articles or reviews.

  4. 2017年11月12日09:07 | #4

    Your style is so unique compared to other folks I have read stuff from.
    I appreciate you for posting when you’ve got the opportunity, Guess I will just book mark this page.

  5. 2017年11月12日20:40 | #5

    When someone writes an article he/she keeps the plan of a user in his/her mind that how a user can understand it.
    So that’s why this article is great. Thanks!

  6. 2017年11月13日10:24 | #6

    Hello! I know this is kinda off topic but I was wondering which blog platform are you using for this site?
    I’m getting sick and tired of WordPress because I’ve had issues with hackers and I’m looking at alternatives
    for another platform. I would be awesome if you could point me in the direction of a good
    platform.

  7. 2017年11月14日00:33 | #7

    Hey just wanted to give you a quick heads up. The words in your article seem to be running off the screen in Ie.
    I’m not sure if this is a formatting issue or something to do with web browser
    compatibility but I thought I’d post to let you know. The design and style look great though!
    Hope you get the issue fixed soon. Cheers

  8. 2017年11月20日17:33 | #8

    Do you have a spam issue on this blog; I also am a blogger,
    and I was wondering your situation; we have developed some nice procedures and we are looking to exchange methods with others,
    be sure to shoot me an email if interested.

  9. 2017年11月22日09:00 | #9

    hey there and thank you for your info – I have certainly picked up something new from right here.
    I did however expertise a few technical points using this web site, as I
    experienced to reload the web site a lot of times previous to I could get it to load
    correctly. I had been wondering if your web hosting is OK?

    Not that I’m complaining, but sluggish loading
    instances times will sometimes affect your placement in google and can damage your high quality score
    if advertising and marketing with Adwords. Anyway I’m adding
    this RSS to my email and could look out for much more of your respective fascinating content.
    Make sure you update this again very soon.

  10. 2017年11月25日05:22 | #10

    Heya are using WordPress for your site platform?

    I’m new to the blog world but I’m trying to get started and set up my
    own. Do you require any html coding expertise to make your own blog?
    Any help would be really appreciated!

  11. 2017年12月15日10:29 | #11

    It’s truly very complex in this active life to listen news on TV,
    therefore I just use world wide web for that reason, and obtain the most up-to-date
    news.

  12. 2017年12月26日12:32 | #12

    casino games
    online casino games
    online casino
    casino online usa
    online casino real money

  13. 2017年12月28日07:12 | #13

    free casino games
    casino online
    casino online
    casino online
    free casino games

  14. 2018年1月2日00:03 | #14

    best online casino to play blackjack
    casino online
    online keno machines

  15. 2018年1月3日13:46 | #15

    payday loans no credit
    payday loans online no credit check
    loans online
    payday loans online
    payday loans no credit

  16. 2018年1月7日12:47 | #16

    free casino games
    online casino real money
    free slots online
    free slots no download
    slots for free

  17. 2018年1月12日12:04 | #17

    autocad 2011 serial and product key
    autocad 2017
    autocad dwg downloads

  18. 2018年1月14日09:17 | #18

    payday loans no credit
    loans for bad credit
    loans no credit
    loans no credit
    loans for bad credit

  19. 2018年1月14日18:39 | #19

    You ought to be a part of a contest for one of the greatest sites on the web.
    I’m going to highly recommend this blog!

  20. 2018年1月18日22:33 | #20

    payday loans no credit check
    payday loans no credit check
    payday loans no credit check
    payday loans no credit check
    payday loans

  21. 2018年1月20日06:43 | #21

    I’m not that much of a online reader to be honest but
    your sites really nice, keep it up! I’ll go ahead and bookmark your website to come back down the road.
    All the best

评论分页
1 2 3 4 24
订阅评论
1+8= (必填)