OpenVZ Forum


Home » General » Support » Bind Mount + User Quotas: Is it possible?
Re: Bind Mount + User Quotas: Is it possible? [message #51792 is a reply to message #51778] Wed, 10 December 2014 20:25 Go to previous message
morrizon is currently offline  morrizon
Messages: 1
Registered: December 2014
Location: Canary Islands (Spain)
Junior Member
I'm using proxmox[1] and OpenVZ with multiple bind mounts[2] and quotas. This is possible because the quotas are managed by other containers.

For example, I want have a LAMP server with two bind mounts, one for the web files (100GB) and another for the MySQL (50GB). I do the following steps:

1. Create 3 containers:
a) webserver101 (id 101): disk 4GB
b) storage102 (id 102): disk 100GB
c) storage103 (id 103): disk 50GB

2. Start all the containers.

3. Generate the folders to mount if doesn't exist. I want mount folders with the name of the container to folders with the of the service:

root@host:~# mkdir /var/lib/vz/root/101/home/www
root@host:~# mkdir /var/lib/vz/root/101/home/mysql
root@host:~# mkdir /var/lib/vz/root/102/home/storage102
root@host:~# mkdir /var/lib/vz/root/103/home/storage103


4. Generate the bind mounts[2] for webserver101 in the host:

root@host:~# cat /etc/vz/conf/101.mount 
#!/bin/bash
. /etc/vz/vz.conf
. ${VE_CONFFILE}
SRC1=/var/lib/vz/private/102/home/storage102
DST1=/home/www
SRC2=/var/lib/vz/private/103/home/storage103
DST2=/home/mysql
 
mount -n -t simfs ${SRC1} ${VE_ROOT}${DST1} -o ${SRC1}
mount -n -t simfs ${SRC2} ${VE_ROOT}${DST2} -o ${SRC2}


5. Restart the container webserver101. It's very important start first the storage containers because they manage the quotas.

The bind mounts in the host:
root@ns398468:~# df -h|grep vz
/dev/mapper/pve-data                                                 1.8T  323G  1.4T  19% /var/lib/vz
/var/lib/vz/private/102                                              100G  603M  100G   1% /var/lib/vz/root/102
none                                                                 256M  4.0K  256M   1% /var/lib/vz/root/102/dev
none                                                                  52M  1.0M   51M   2% /var/lib/vz/root/102/run
none                                                                 5.0M     0  5.0M   0% /var/lib/vz/root/102/run/lock
none                                                                 256M     0  256M   0% /var/lib/vz/root/102/run/shm
/var/lib/vz/private/103                                               50G  603M   50G   2% /var/lib/vz/root/103
none                                                                 256M  4.0K  256M   1% /var/lib/vz/root/103/dev
none                                                                  52M  1.0M   51M   2% /var/lib/vz/root/103/run
none                                                                 5.0M     0  5.0M   0% /var/lib/vz/root/103/run/lock
none                                                                 256M     0  256M   0% /var/lib/vz/root/103/run/shm
/var/lib/vz/private/101                                              4.0G  603M  3.5G  15% /var/lib/vz/root/101
/var/lib/vz/private/102/home/storage102                              100G  603M  100G   1% /var/lib/vz/root/101/home/www
/var/lib/vz/private/103/home/storage103                               50G  603M   50G   2% /var/lib/vz/root/101/home/mysql
none                                                                 2.0G  4.0K  2.0G   1% /var/lib/vz/root/101/dev
none                                                                 410M  1.0M  409M   1% /var/lib/vz/root/101/run
none                                                                 5.0M     0  5.0M   0% /var/lib/vz/root/101/run/lock
none                                                                 2.0G     0  2.0G   0% /var/lib/vz/root/101/run/shm


The bind mounts in the container:
root@ns398468:~# vzctl enter 101
entered into CT 101
root@webserver101:/# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/simfs      4.0G  603M  3.5G  15% /
/dev/simfs      100G  603M  100G   1% /home/www
/dev/simfs       50G  603M   50G   2% /home/mysql
none            2.0G  4.0K  2.0G   1% /dev
none            410M  1.0M  409M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            2.0G     0  2.0G   0% /run/shm


I'm sure there is a better solution that don't need to create storage containers and waste disk space and memory but this work for me Wink

[1] See proxmox DOT com
[2] See article of jamescoyle DOT net -> search in google 525-proxmox-bind-mount-mount-storage-in-a-container (sorry, cannot use links because limit of the forum)
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Moving Container/Ploop to New Drive
Next Topic: OpenVZ on Ubuntu 14.04.1 Kernel 3.13.11.6
Goto Forum:
  


Current Time: Sun Nov 03 22:35:35 GMT 2024

Total time taken to generate the page: 0.03564 seconds