OpenVZ Forum


Home » General » Support » Bind Mount + User Quotas: Is it possible?
Bind Mount + User Quotas: Is it possible? [message #33366] Wed, 08 October 2008 22:13 Go to next message
jimp is currently offline  jimp
Messages: 3
Registered: October 2008
Junior Member
I followed the OpenVZ bind mount guide and it worked great! However, I cannot seem to get second level (user/group) quotas working for the files located within the bind mount.

The CT's second level quotas are working, but it is clear that they only account for files truly within the CT. Files located in /home (within the bind mount) do not contribute to the quotas at all.

Configuration:
  1. The CT is located in /home/vz/private/###.
  2. The /home bind mount points to /data/vz/###/home.
  3. /home and /data are two different partitions mounted on the HN like this:
    • /dev/xxx /data xfs rw,relatime,usrquota,grpquota 0 0
    • /dev/xxx /home xfs rw,relatime,usrquota,grpquota 0 0
Am I doing something wrong?
Re: Bind Mount + User Quotas: Is it possible? [message #33388 is a reply to message #33366] Fri, 10 October 2008 18:47 Go to previous messageGo to next message
jimp is currently offline  jimp
Messages: 3
Registered: October 2008
Junior Member
I figured it out.

My partitions were XFS, which OpenVZ does not support for disk quotas. My mistake was thinking that "disk quotas" meant OpenVZ could not limit the container size, but user/group quotas would still work. Wrong. They do not work at all within the CT.

Switched to ext3 partitions

Quotas over the bind mount do not work under any configurations I tried: bind mount to folder on another partion or bind mount to a folder on the same partition. The end result was quota tracking within the bind mount never worked.

Questions

We wanted to use a bind mount to keep customer "homes" out of the way of destructive commands such as "vzctl destroy ###". But customers need quotas. Is there any way to achieve this?

In a dedicated server setup, we would normally do a partitioning scheme like this:

/
/boot
/root
/var
/home <-- quotas enabled

We would like a CT scheme like this:

/
/home <-- quotas enabled, not as a mounted partition but as a bind mounted folder on a common HN partition

Feature request, maybe? Smile
Re: Bind Mount + User Quotas: Is it possible? [message #33565 is a reply to message #33388] Wed, 22 October 2008 16:04 Go to previous messageGo to next message
silentninja is currently offline  silentninja
Messages: 37
Registered: September 2007
Member
I'm looking for something really similar to this

My plan is to have some partitioning on the VZ:

/ (symfs, the vz private folder)

/usr/local/apache
/var
/tmp (noexec,nosuid)
/home (quotas)


It's really simple to do this by editting the fstab on the node and I think that it would be done from within a vps, but I've read that it's not possible to mount a partition inside a vps as ext3 because it only works on ext2 partitions.


Is it possible to do this kind of partitioning with bind (mounting on vz root) and that it works ok with all the quota and such ?
Re: Bind Mount + User Quotas: Is it possible? [message #33614 is a reply to message #33565] Sat, 25 October 2008 10:32 Go to previous messageGo to next message
Aefron is currently offline  Aefron
Messages: 10
Registered: July 2008
Junior Member
For what I tested, you can mount the partitions on the host, then bind-mount those in VEs, but then VZ quotas will not work (I do not know for such things as user quotas on bind-mounts - did not test ; but it would also be good)... so, you will have to size the partitions according to your need before bind-mouting them...

Having VZ and users quotas on bind-mounts would certainly be an excellent feature, bringing a real lot of flexibility : so much more straightforward than a LVM - this is definitely something I would second as a feature request.
Re: Bind Mount + User Quotas: Is it possible? [message #33617 is a reply to message #33614] Sat, 25 October 2008 18:40 Go to previous messageGo to next message
silentninja is currently offline  silentninja
Messages: 37
Registered: September 2007
Member
What can I do to use external partitions (to avoid fragmentation and fsck times), and also use userquota on the home partition?

Would it be good if I mount the partition as ext2 inside the VE, instead of mounting it as ext3 from the outside node to it ?

What would I loose if I rollback to ext2 ?
Re: Bind Mount + User Quotas: Is it possible? [message #33640 is a reply to message #33366] Mon, 27 October 2008 15:12 Go to previous messageGo to next message
silentninja is currently offline  silentninja
Messages: 37
Registered: September 2007
Member
Not a chance to mount external partitions and use internal vz quotas ?
Re: Bind Mount + User Quotas: Is it possible? [message #33749 is a reply to message #33366] Fri, 07 November 2008 14:36 Go to previous messageGo to next message
silentninja is currently offline  silentninja
Messages: 37
Registered: September 2007
Member
Bump

Would it help, to mount the other partitions with some other mode, like nfs or reiserfs... etc ?

The fact is that I need this configuration by MINIMUM

/ => simfs
/home => external partition

/ => simfs2
/mysql => external partition
Re: Bind Mount + User Quotas: Is it possible? [message #36384 is a reply to message #33749] Sat, 13 June 2009 11:48 Go to previous messageGo to next message
marotori is currently offline  marotori
Messages: 3
Registered: June 2009
Junior Member
Has this ever been solved?

I need a very similar solutions!
Re: Bind Mount + User Quotas: Is it possible? [message #36387 is a reply to message #33366] Sat, 13 June 2009 14:01 Go to previous messageGo to next message
silentninja is currently offline  silentninja
Messages: 37
Registered: September 2007
Member
Nope, I'm still unable to mount a partition by bind mount without the openvz quota / space usage to go nuts.

I was able to "semi-fix" it, by mounting the partition from the HN inside the VE via NFS; but when the VE hangs by anything, you have to restart the full HN, because if you stop the VE, the hole HN hangs because of something strange on the portmap/nfs kernel usage of openvz. It's not really usefull, but.. it works by now.
Re: Bind Mount + User Quotas: Is it possible? [message #41404 is a reply to message #33366] Sat, 15 January 2011 16:11 Go to previous messageGo to next message
jmjosebest is currently offline  jmjosebest
Messages: 1
Registered: January 2011
Junior Member
Sad
It's completly imposible?

[Updated on: Sat, 15 January 2011 20:12]

Report message to a moderator

Re: Bind Mount + User Quotas: Is it possible? [message #51708 is a reply to message #33366] Fri, 17 October 2014 17:25 Go to previous messageGo to next message
kamranonline is currently offline  kamranonline
Messages: 16
Registered: February 2007
Junior Member
Hi,

Did anybody find a solution ?

I used mount --bind /xxx /home2 to mount /home2 into my VPS but quota cannot be enabled on /home2 Sad
How can I fix this problem ?

Thank you
Re: Bind Mount + User Quotas: Is it possible? [message #51712 is a reply to message #51708] Sat, 18 October 2014 09:26 Go to previous messageGo to next message
kir is currently offline  kir
Messages: 1645
Registered: August 2005
Location: Moscow, Russia
Senior Member

You need to use simfs mount (see an example in vzctl(Cool man page) and manually enable second-level quota using vzquota(Cool tool

Kir Kolyshkin
http://static.openvz.org/userbars/openvz-developer.png
Re: Bind Mount + User Quotas: Is it possible? [message #51755 is a reply to message #51712] Fri, 07 November 2014 14:22 Go to previous messageGo to next message
kamranonline is currently offline  kamranonline
Messages: 16
Registered: February 2007
Junior Member
kir wrote on Sat, 18 October 2014 05:26
You need to use simfs mount (see an example in vzctl(Cool man page) and manually enable second-level quota using vzquota(Cool tool



Hi,

I mount it as simfs but I dont know how to use vzquota for this partition.
As you can see /home2 mounted as simfs filesystem.

root@at1 [/]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/simfs      220G  124G   86G  60% /
/dev/simfs      917G  100G  771G  12% /home2
none            4.0G  8.0K  4.0G   1% /dev



root@at1 [/]# mount
/dev/simfs on / type simfs (rw,relatime,usrquota,grpquota)
/dev/simfs on /home2 type simfs (rw,relatime)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
none on /dev type devtmpfs (rw,relatime,mode=755)
devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620,ptmxmode=000)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)



but How to add usrquota , grpquota to Calculate Quota on this mounted point !

/etc/vz/conf/101.mount
#!/bin/sh
. /etc/vz/vz.conf
. /etc/vz/conf/101.conf
SRC=/vz5/101home2
DST=/home2
echo "Starting ${VEID}.mount..."
if [ ! -e ${VE_ROOT}${DST} ]; then mkdir -p ${VE_ROOT}${DST}; fi
mount  -n -t simfs ${SRC} ${VE_ROOT}${DST} -o ${SRC}
echo "...${VEID}.mount complete"

[Updated on: Fri, 07 November 2014 14:34]

Report message to a moderator

Re: Bind Mount + User Quotas: Is it possible? [message #51778 is a reply to message #33366] Sat, 29 November 2014 09:36 Go to previous messageGo to next message
kamranonline is currently offline  kamranonline
Messages: 16
Registered: February 2007
Junior Member
Hi,

Any one can help to use QUOTA to second harddisk ?
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)
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: Thu Mar 28 17:02:22 GMT 2024

Total time taken to generate the page: 0.01798 seconds