OpenVZ Forum


Home » General » Support » I find a Copy On Write Solution for openVZ
I find a Copy On Write Solution for openVZ [message #6800] Fri, 22 September 2006 18:07 Go to previous message
themoonseeker is currently offline  themoonseeker
Messages: 12
Registered: September 2006
Junior Member
Hi,

Finally, after many tests i have found a Copy On Write solution for openVZ. Let me show you :

1 : install lvm

apt-get install lvm2

2 : create a LVM physical volume

pvcreate /dev/hde8

3 : Create a LVM group

vgcreate openvz /dev/hde8

4 : Create a volume and format it in ext3

lvcreate -L200M -n vps-core openvz
mkfs -t ext3 /dev/openvz/vps-core

5 : Create VPS 201 area and mount the logical volume

mkdir -p /mnt/201/root /mnt/201/private
mount /dev/openvz/vps-core /mnt/201

6 : Populate the 201 area

cd /var/lib/vz/template/cache/
wget http://download.openvz.org/template/precreated/debian-3.1-i3 86-minimal.tar.gz
cd /mnt/201/private/
tar zxvf /var/lib/vz/template/cache/debian-3.1-i386-minimal.tar.gz /mnt/201/private/

7 : Unmount the logical volume (for a snapshot)

umount /mnt/201/

8 : Create the 201 config file

echo "# Copyright (C) 2000-2006 SWsoft. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#

ONBOOT="no"

# UBC parameters (in form of barrier:limit)
# Primary parameters
AVNUMPROC="15:15"
NUMPROC="40:40"
NUMTCPSOCK="40:40"
NUMOTHERSOCK="40:40"
VMGUARPAGES="1725:2147483647"
# Secondary parameters
KMEMSIZE="1740800:1847296"
TCPSNDBUF="159744:262144"
TCPRCVBUF="159744:262144"
OTHERSOCKBUF="61440:163840"
DGRAMRCVBUF="32768:32768"
OOMGUARPAGES="1725:2147483647"
# Auxiliary parameters
LOCKEDPAGES="4:4"
SHMPAGES="1152:1152"
PRIVVMPAGES="7680:8448"
NUMFILE="512:512"
NUMFLOCK="50:60"
NUMPTY="4:4"
NUMSIGINFO="256:256"
DCACHESIZE="196608:202752"

PHYSPAGES="0:2147483647"
NUMIPTENT="16:16"

# Disk quota parameters (in form of softlimit:hardlimit)
DISKSPACE="512000:512000"
DISKINODES="80000:88000"
QUOTATIME="0"

# CPU fair sheduler parameter
CPUUNITS="250"

VE_ROOT="/mnt/201/root"
VE_PRIVATE="/mnt/201/private"
OSTEMPLATE="debian-3.1-i386-minimal" >> /etc/vz/conf/201.conf

9 : create the 202 conf file

cp /etc/vz/conf/201.conf /etc/vz/conf/202.conf

vi /etc/vz/conf/202.conf

replace :

VE_ROOT="/mnt/201/root"
VE_PRIVATE="/mnt/201/private"

with this

VE_ROOT="/mnt/202/root"
VE_PRIVATE="/mnt/202/private"

10 : Create the snapshot

lvcreate -s -L100M -n vps202 /dev/openvz/vps-core

11 : Mount the 201 core

mount /dev/openvz/vps-core /mnt/201

12 : Mount the 202 copy on write

mkdir -p /mnt/202
mount /dev/openvz/vps202 /mnt/202/

13 : And finally start the two vps

vzctl start 201
vzctl start 202

Now let me show the memory saved :

themoonseeker:/# lvs
LV VG Attr LSize Origin Snap% Move Log Copy%
vps-core openvz owi-a- 200.00M
vps202 openvz swi-ao 100.00M vps-core 0.95

I'd like to use this solution for a virtual network editor.

What do you think about this solution? especially about stability and performance?

Thanks! Smile
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: *SOLVED* veth
Next Topic: Oracle DB and VPS
Goto Forum:
  


Current Time: Thu Sep 05 21:19:47 GMT 2024

Total time taken to generate the page: 0.07874 seconds