Changes

Jump to: navigation, search

Physical to container

1,723 bytes added, 14:23, 14 September 2006
created
A rough description of how to migrate existing physical server into a [[VE]].

What you need to do in order to migrate is:

* Prepare an “empty” VE. For OpenVZ this would mean the following (assume you choose VE ID of 123):

mkdir /vz/root/123 /vz/private/123
cat ve-vps.basic.conf-sample > /etc/vz/conf/123.conf

* Stop most services on a machine to be migrated. “Most” means services such as web server, databases and the like — so you will not loose your data. Just leave the bare minimum (including ssh).

* Copy all your data from the machine to an OpenVZ box. Say you'll be using VE with ID of 123, then all the data should be placed to <code>/vz/private/123/</code> directory (so there will be directories such as <code>/vz/private/123/bin</code>, <code>etc</code>, <code>var</code> and so on).

* Set some VE parameters. You have to add <code>OSTEMPLATE=xxx</code> line to <code>/etc/vz/conf/123.conf</code> file, where <code>xxx</code> would be distribution name (like <code>debian-3.0</code>) for vzctl to be able to make changes specific for this distribution.

: Also, you have to supply an IP for a new VE:

vzctl set 123 --ipadd x.x.x.x --save

* You have to edit some files inside a VE. For example, virtual server does not have real ttys, so you have to disable getty in <code>/etc/inittab</code> (i. e. <code>/vz/private/123/etc/inittab</code>). Also, link <code>/etc/mtab</code> to <code>/proc/mounts</code>.

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

: There might be other adjustments needed.

* Try to start your new VE:
vzctl start 123

If anything goes wrong, try to find out why and fix. If you have enough Linux experience, it can be handled.

Navigation menu