Migrating from OpenVZ to Linux-Vserver

From Linux-VServer

Revision as of 23:22, 21 October 2011 by Glenn (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

So, you've repeatedely heard that OpenVZ was hip, better than Linux-Vserver even, and thought you'd give it a try? So did we! However, you weren't as pleased as you were supposed to be, and kept thinking back about how Linux-Vserver was cool for you? Well, if that's your case too, here's how we moved back to Linux-Vserver in a few simple keystrokes.


System info


We are running Debian GNU/Linux, in its testing flavour (pre-release Lenny, frozen package base). For OpenVZ, we were using Debian kernel 2.6.26 with OpenVZ patches. For Linux-Vserver, we are using Debian kernel 2.6.25 with Linux-Vserver patches.


We created our OpenVZ CTs under /srv/vps/$VEID/{private,root}/, and our vservers under /srv/vservers/.


Copying data

After rebooting under the -vserver kernel, here's how we migrated each VPS, using the 'rsync method':

[sudo] vserver $vname build -m rsync \
               --hostname $vhostname \
               --interface $interface:$ip \
               --context $ctx -- \
               --source /srv/vps/$veid/private/ -o -va

So, for migrating an OpenVZ CT named 'seitan' using '' on 'eth0', in context '666', the command would look like:

sudo vserver seitan build -m rsync \
             --hostname seitan \ 
             --interface eth0: \
             --context 666 -- \
             --source /srv/vps/seitan/private/ -o -va

Note the trailing -o -va, which allows us to follow rsync as it goes.

Fix daemons

When rsync is done, we can't start our vservers yet, because some of the system daemons that OpenVZ allows are not compatible with a Vserver environment. Let's remove their startup links, then!

To do so, let's chroot into our freshly migrated vserver:

sudo chroot /srv/vservers/seitan/

Once inside, let's unlink all the undesired daemons:

for undesired in klogd hwclock.sh setserial urandom networking umountfs halt reboot ; 
    do update-rc.d -f $undesired remove ;


Let's log out of the chroot, and start our vserver!

sudo vserver seitan start

It should work fine, provided some of your daemons don't depend upon bind mounts from host, which then need to be integrated into the fstab for each of your vservers.

Welcome back!

Personal tools