Difference between revisions of "Talk:Physical to container"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
Line 28: Line 28:
 
ln -s /proc/mounts /vz/private/300/etc/mtab
 
ln -s /proc/mounts /vz/private/300/etc/mtab
 
</pre>
 
</pre>
 +
 +
== Use Dummy ==
 +
 +
Having been completely clueless about Openvz three days ago I first created a dummy container based on the same distribution I wanted to migrate. This helped me greatly to understand what was needed and also allowed to use the dummy as a template for /dev and the conf file. Disregarding the time to setup the host system the actual migration from the physical machine with tar ball took me two hours and the migrated container started up on second attempt after first complaining about disk size. I increased that and it runs. I am very impressed by the ease of it all.

Revision as of 17:38, 26 May 2008

RSync Command

Please check the following command, Ive used with success:

rsync -arvpz --numeric-ids --exclude dev --exclude proc --exclude tmp --exclude mnt --exclude sys -e "ssh -l root@a.b.c.d" root@a.b.c.d:/ /vz/private/123/

Migration Script

I composed a little Script to migrate a Debian Sarge Box to OpenVZ. (Some System specific steps have been removed)

#!/bin/sh
echo "Stopping VE 300..."
vzctl stop 300
echo "Creating base filesystem /dev /proc ..."
mknod /vz/private/300/dev/ptmx c 5 2
mkdir /vz/private/300/dev/pts
rm -f /vz/private/300/dev/null
mknod /vz/private/300/dev/null c 1 3
chmod o+rw /vz/private/300/dev/null
echo "Copy the tty's to VE and Set Permissions"
cp -r /dev/ttyp* /dev/ptyp* /vz/private/300/dev/
chmod o+wx /vz/private/300/dev/*typ*
echo "Creating /dev/random and Set Permissions"
mknod -m 644 /vz/private/300/dev/random c 1 8
mknod -m 644 /vz/private/300/dev/urandom c 1 9
chown root:root /vz/private/300/dev/random /vz/private/300/dev/urandom
echo "clearing mtab / fstab..."
echo -n > /vz/private/300/etc/fstab
rm /vz/private/300/etc/mtab
ln -s /proc/mounts /vz/private/300/etc/mtab

Use Dummy

Having been completely clueless about Openvz three days ago I first created a dummy container based on the same distribution I wanted to migrate. This helped me greatly to understand what was needed and also allowed to use the dummy as a template for /dev and the conf file. Disregarding the time to setup the host system the actual migration from the physical machine with tar ball took me two hours and the migrated container started up on second attempt after first complaining about disk size. I increased that and it runs. I am very impressed by the ease of it all.