How to convert a KVM image in to an openvz container in Proxmox?

Discussion in 'HOWTO-Related Questions' started by kumarullal, Jun 25, 2009.

  1. kumarullal

    kumarullal New Member

    Hi Falko,
    I followed your article "How To Convert Physical Systems And Xen VMs Into OpenVZ Containers (Debian Etch)"
    I need some clarification.
    I am using proxmox. So KVM and openvz reside on the same system.
    I have setup up a kvm image of centos based asterisk system just the way I want it. Now, I want to convert that into an openvz container.

    so what should I do to apply your instructions in proxmox's context.

    You instructions

    " server1/server2:

    apt-get install rsync

    Now let's transfer server1's files to the OpenVZ container:


    rsync -arvpz --numeric-ids --exclude dev --exclude proc --exclude tmp -e "ssh -l [email protected]" [email protected]:/ /vz/private/211/ "

    After that is answered, what value should I put in your example
    " vzctl set 211 --ostemplate debian-4.0-i386-minimal --save "

    The Os is centos 5.

    Thanks in advance
    Last edited: Jun 25, 2009
  2. kumarullal

    kumarullal New Member

    Got stuck

    I could rsync my asterisk pbx based on Centos 5 with Ip to my Proxmox server

    It imported the files and everything.
    According to your instructions

    vzctl set 211 --onboot yes --save
    vzctl set 211 --hostname --save
    vzctl set 211 --ipadd --save
    vzctl set 211 --numothersock 120 --save
    vzctl set 211 --nameserver --nameserver --save
    vzctl set 211 --diskspace 10000000:11000000 --save

    How do I set Swap and memory ?

    I followed the remaining instructions

    sed -i -e '/getty/d' /vz/private/211/etc/inittab
    rm -f /vz/private/211/etc/mtab
    ln -s /proc/mounts /vz/private/211/etc/mtab

    cp /vz/private/211/etc/fstab /vz/private/211/etc/fstab.old
    grep devpts /vz/private/211/etc/fstab.old > /vz/private/211/etc/fstab
    mkdir /vz/private/211/dev
    mknod --mode 666 /vz/private/211/dev/ptmx c 5 2
    mkdir /vz/private/211/dev/pts
    cp -a /dev/ttyp* /dev/ptyp* /vz/private/211/dev/
    rm -f /vz/private/211/dev/null
    mknod --mode 666 /vz/private/211/dev/null c 1 3
    mknod --mode 444 /vz/private/211/dev/urandom c 1 9
    mkdir /vz/private/211/proc

    But I got stuck at
    cat /dev/null > /vz/private/211/etc/network/interfaces

    Since I have Centos Running, I dont have the interfaces file.
    So which is the file equivalent to interfaces, in Centos
    For example
    the path to all the config files in Centos is
    Then there are number of files there.
    So which is the correct file.

    And finally

    According to your command
    cat /dev/null > /vz/private/211/etc/network/interfaces
    When I lookup up the /dev/null file, it is totally empty.
    So why is this step required?

    Thanks in advance.
  3. falko

    falko Super Moderator ISPConfig Developer

    I haven't tried this with CentOS, but I guess it's /etc/sysconfig/network-scripts/ifcfg-eth0. According to you must set
    in that file.

Share This Page