Backup VPS using vzdump

Vzdump is a utility to make consistent snapshots of running OpenVZ containers. It basically creates a tar archive of the container’s private area, which also includes the container configuration files. It stores the backup on the disk in a single tar file.

Download vzdump rpm packages from http://download.openvz.org/contrib/utils/vzdump and install the rpm package on the server.

# rpm -ivh vzdump.x.x.x.rpm

How to backup container.

Simply dump CT 777 — no snapshot, just archive the container private area and configuration files to the default dump directory, usually in /vz/dump.

vzdump 777

Use rsync and suspend/resume to create a snapshot (minimal downtime).

vzdump –suspend 777

Backup all containers and send notification mails to root.

vzdump –suspend –all –mailto root

Use LVM2 to create snapshots (no downtime).

vzdump –dumpdir /space/backup –snapshot 777

Note that using LVM2 and vzdump to create snapshots requires 512Mb of free space in your VG.

How to restore the container.

Restore the above backup to CT 600:

vzrestore /space/backup/vzdump-777.tar 600

OR

vzdump –restore /space/backup/vzdump-777.tar 600

Courtesy: http://wiki.openvz.org

Install /dev/net/tun in a VPS

VPN support for a VPS Hosting via the TUN/TAP device is available. To allow VE #700 to use the TUN/TAP device, the following steps are required:

* Make sure the tun module has been already loaded on the hardware node:

lsmod | grep tun

If it is not there, then issue the command ‘modprobe tun’ to load it and add it into /etc/modules.conf. This module should be loaded before Virtuozzo is started, so you should run ‘service vz restart’ to make it available at runtime.

* Allow the VPS Hosting to use the tun/tap device:

vzctl set 700 –devices c:10:200:rw –save

* Create the device in the VPS Hosting:

vzctl exec 700 mkdir -p /dev/net
vzctl exec 700 mknod /dev/net/tun c 10 200

* Set proper permissions for /dev/net/tun:

vzctl exec 700 chmod 600 /dev/net/tun

You are done.