Open main menu

OpenVZ Virtuozzo Containers Wiki β

Changes

Physical to container

835 bytes added, 22:33, 22 March 2007
copying the data: separated by subsections; info about /dev/urandom moved to separate subsection; added info about init.d services
== Copying the data ==
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). This could be done by scp or rsync.in several ways:
=== rsync ===
rsync example (run from the new HN):
rsync -arvpz --numeric-ids --exclude dev --exclude proc --exclude tmp -e "ssh -l root@a.b.c.d" root@a.b.c.d:/ /vz/private/123/
'''Advantage:''' Your system doesn't really go down.
=== Live CD ===
Another way to do is using a live cd, booting up and use tar to dump the complete disk in a tar you save over the network or on a USB device.
=== Tar ===
Another approach is using tar and excluding some dirs, you could do it like this:
Check that /dev/ptmx exists. If it does not, create with:
mknod /vz/private/123/dev/ptmx c 5 2
 
==== /dev/urandom ====
Check that /dev/urandom exists. If it does not, create with:
mknod /vz/private/123/dev/urandom c 1 9
==== /dev/pts/ ====
or
cd /vz/private/123/dev && /sbin/MAKEDEV ttyp
 
=== Other devices ===
 
==== /dev/urandom ====
Check that /dev/urandom exists. If it does not, create with:
mknod /vz/private/123/dev/urandom c 1 9
 
=== Services ===
 
Some system services can or should be disabled. A few good candidates are:
* acpid (not needed)
* checkfs, checkroot (no filesystem checking is required in VE)
* clock (no clock setting is required/allowed in VE)
* consolefont (VE does not have a console)
* hdparm (VE does not have real hard drives)
* klogd (unless you use iptables to LOG some packets)
* keymaps (VE does not have a real keyboard)
 
To see which services are enabled:
* RedHat/Fedora/SUSE: <code>/sbin/chkconfig --list</code>
* Debian: <code>*FIXME*</code>
* Gentoo: <code>/sbin/rc-update show</code>
 
To disable the service:
* RedHat/Fedora/SUSE: <code>/sbin/chkconfig --del SERVICENAME </code>
* Debian: <code>*FIXME*</code>
* Gentoo: <code>/sbin/rc-update del SERVICENAME</code>
=== Other ===