zoukankan      html  css  js  c++  java
  • 改造xen镜像

    今天是想改造一下xen的镜像文件来着,从官网上下了一个镜像文件,然后是个10G的硬盘文件。直接装dom U的话,系统就直接跑在了这个硬盘文件上。
    现在想把这个10G的变成20G的。初步是这么想的,将这个跑起来的10G的系统做成一个小的模版,在放到dd出来的20G的文件中去。参考了这篇文章:
    http://www.vpsee.com/2011/04/how-to-create-a-xen-file-image-faster/
    在制作centos.tar.gz 这个镜像的时候,tar的指令之后,压缩出来的东西死活都不对,看了一下出错的目录,集中在sys和proc上面,这两个目录都是虚拟文件系统相关的,都是保存内存中的东西的,想着这两个应该不需要tar进去,于是在tar指令中 --exclude了这两个目录,那个lost+found目录是关于ext3的,所以也--exclude掉了,之后的tar指令如下:
    tar -zcvpf  centos.tar.gz  --exclude=/centos.tar.gz --exclude=/lost+found --exclude=/sys --exclude=/proc  / 2>error.log
    看了一下错误输出,基本上没有啥错误了。

    于是将压缩的centos.tar.gz解压到了自己dd的一个20G的文件中。

    之后利用xen进行虚拟机的创建。结果就创建错了。

    错误如下:
    Setting up other filesystems.
    Setting up new root fs
    setuproot: moving /dev failed: No such file or directory
    no fstab.sys, mounting internal defaults
    setuproot: error mounting /proc: No such file or directory
    setuproot: error mounting /sys: No such file or directory
    Switching to new root and running init.
    unmounting old /dev
    unmounting old /proc
    unmounting old /sys
    switchroot: mount failed: No such file or directory
    Kernel panic - not syncing: Attempted to kill init!


    貌似是说啥/dev /proc /sys没这些目录。

    于是重新在20G的文件中自己mkdir了这些目录,不过里面的内容是空的。

    再创建虚拟机。
    还是这些错误。
    无语了。

    明天继续这个问题。



    下面是一些指令:
    # tar -zxSf centos.tar.gz -C /mnt/  
    tar -zcvpf  centos.tar.gz  --exclude=/centos.tar.gz --exclude=/lost+found --exclude=/sys --exclude=/proc  / 2>error.log
    mkfs.ext3 test.img

    初步方案 传送门: http://www.cnblogs.com/cyttina/admin/EditPosts.aspx?opt=1

  • 相关阅读:
    awk,seq,xarg实例使用
    Docker安装yapi
    基于阿里搭载htppd访问
    锐捷结课作业
    基于centos7搭建kvm
    基于django实现简易版的图书管理系统
    python 自定义log模块
    Interesting Finds: 2008.01.13
    Interesting Finds: 2008.01.24
    Interesting Finds: 2008.01.17
  • 原文地址:https://www.cnblogs.com/cyttina/p/2863290.html
Copyright © 2011-2022 走看看