OpenVZ Forum


Home » Mailing lists » Users » Split VE disk space between / and /var?
Split VE disk space between / and /var? [message #26678] Wed, 30 January 2008 16:42 Go to next message
Jan Tomasek is currently offline  Jan Tomasek
Messages: 44
Registered: December 2006
Member
Hi,

I was asked for VE with disk space splitup this way:

	/	using 3GB
	/var	using 12GB

is this posible with OpenVZ? Only way I figured out is to create special 
partion on HW node with required size and allow access to device for VE, 
or mount it outside and use mount -o bind. Both ways are not very nice...

I'm asking to be sure there is no simpler way how achieve such split.

Thanks
-- 
-----------------------
Jan Tomasek aka Semik
http://www.tomasek.cz/
Re: Split VE disk space between / and /var? [message #26680 is a reply to message #26678] Wed, 30 January 2008 18:05 Go to previous messageGo to next message
dev is currently offline  dev
Messages: 1693
Registered: September 2005
Location: Moscow
Senior Member

it's possible to do the following:
- create some directory, say /vz/private/ID.2
- turn on vzquota on this directory (quota ID maybe VEID+some bug number, say 1000000)
- bind (u)mount /vz/private/ID.2 to /vz/root/ID/var in VE.(u)mount scripts.


Jan Tomasek wrote:
> Hi,
> 
> I was asked for VE with disk space splitup this way:
> 
>     /    using 3GB
>     /var    using 12GB
> 
> is this posible with OpenVZ? Only way I figured out is to create special
> partion on HW node with required size and allow access to device for VE,
> or mount it outside and use mount -o bind. Both ways are not very nice...
> 
> I'm asking to be sure there is no simpler way how achieve such split.
> 
> Thanks
Re: Split VE disk space between / and /var? [message #26691 is a reply to message #26680] Wed, 30 January 2008 20:11 Go to previous messageGo to next message
Jan Tomasek is currently offline  Jan Tomasek
Messages: 44
Registered: December 2006
Member
Kirill Korotaev wrote:
> it's possible to do the following:
> - create some directory, say /vz/private/ID.2
> - turn on vzquota on this directory (quota ID maybe VEID+some bug number, say 1000000)
> - bind (u)mount /vz/private/ID.2 to /vz/root/ID/var in VE.(u)mount scripts.

That is quite interesting thanks! But I need bit more help.

Start of VE is fine:

chlivek:~# vzctl start 192003
Starting VE ...
+ mount --bind /staj/vz/private/192003.mnt /staj/vz/root/192003/mnt
VE is mounted
Adding IP address(es): 192.168.0.3
Setting CPU units: 1000
Configure meminfo: 65536
Set hostname: dns
VE start in progress...

But stop not:

chlivek:~# vzctl enter 192003
entered into VE 192003
root@dns:/# ls /mnt
big  x  xx

chlivek:~# vzctl stop 192003
Stopping VE ...
VE was stopped
+ ls -l /staj/vz/root/192003/mnt
total 0
+ umount /staj/vz/root/192003/mnt
umount: /staj/vz/private/192003.mnt: not mounted
umount: /staj/vz/private/192003.mnt: not mounted
+ exit 0
VE is unmounted

Mount point /staj/vz/root/192003/mnt doesn't exist at moment of calling.
But when I do not call umout it hangs in system mount tab.

I'm also interested if it's posible to have inside VE df showing correct
info, instead of total HW node capacity.

root@dns:/# df -h
Filesystem            Size  Used Avail Use% Mounted on
simfs                 1.0G  370M  655M  37% /
/dev2/root2           1.1T   46G 1020G   5% /mnt
tmpfs                 4.0G     0  4.0G   0% /lib/init/rw
tmpfs                 4.0G     0  4.0G   0% /dev/shm


Thanks
-- 
-----------------------
Jan Tomasek aka Semik
http://www.tomasek.cz/
Re: Split VE disk space between / and /var? [message #26702 is a reply to message #26691] Thu, 31 January 2008 06:42 Go to previous messageGo to next message
dev is currently offline  dev
Messages: 1693
Registered: September 2005
Location: Moscow
Senior Member

Jan Tomasek wrote:
> Kirill Korotaev wrote:
>> it's possible to do the following:
>> - create some directory, say /vz/private/ID.2
>> - turn on vzquota on this directory (quota ID maybe VEID+some bug number, say 1000000)
>> - bind (u)mount /vz/private/ID.2 to /vz/root/ID/var in VE.(u)mount scripts.
> 
> That is quite interesting thanks! But I need bit more help.
> 
> Start of VE is fine:
> 
> chlivek:~# vzctl start 192003
> Starting VE ...
> + mount --bind /staj/vz/private/192003.mnt /staj/vz/root/192003/mnt
> VE is mounted
> Adding IP address(es): 192.168.0.3
> Setting CPU units: 1000
> Configure meminfo: 65536
> Set hostname: dns
> VE start in progress...
> 
> But stop not:
> 
> chlivek:~# vzctl enter 192003
> entered into VE 192003
> root@dns:/# ls /mnt
> big  x  xx
> 
> chlivek:~# vzctl stop 192003
> Stopping VE ...
> VE was stopped
> + ls -l /staj/vz/root/192003/mnt
> total 0
> + umount /staj/vz/root/192003/mnt
> umount: /staj/vz/private/192003.mnt: not mounted
> umount: /staj/vz/private/192003.mnt: not mounted

that's because VE distro specific init scripts do umount of everything on stop.
so you can ignore this warning (but leave umount just in case).

> + exit 0
> VE is unmounted
> 
> Mount point /staj/vz/root/192003/mnt doesn't exist at moment of calling.
> But when I do not call umout it hangs in system mount tab.

check -n option to mount.

> 
> I'm also interested if it's posible to have inside VE df showing correct
> info, instead of total HW node capacity.
> 
> root@dns:/# df -h
> Filesystem            Size  Used Avail Use% Mounted on
> simfs                 1.0G  370M  655M  37% /
> /dev2/root2           1.1T   46G 1020G   5% /mnt
> tmpfs                 4.0G     0  4.0G   0% /lib/init/rw
> tmpfs                 4.0G     0  4.0G   0% /dev/shm

have you called vzquota on on this directory?
plz check vzquota init, on, off commands.
you will need to assign some numerical ID to this quota directory (should be different from VEID),
setup vzquota on it and simply turn it on before bind mount.

Kirill
Re: Split VE disk space between / and /var? [message #26704 is a reply to message #26702] Thu, 31 January 2008 07:34 Go to previous message
Jan Tomasek is currently offline  Jan Tomasek
Messages: 44
Registered: December 2006
Member
Kirill Korotaev wrote:
>> chlivek:~# vzctl stop 192003
>> Stopping VE ...
>> VE was stopped
>> + ls -l /staj/vz/root/192003/mnt
>> total 0
>> + umount /staj/vz/root/192003/mnt
>> umount: /staj/vz/private/192003.mnt: not mounted
>> umount: /staj/vz/private/192003.mnt: not mounted
> 
> that's because VE distro specific init scripts do umount of everything on stop.
> so you can ignore this warning (but leave umount just in case).

Ok. I modified my umount script to not show errors:

#!/bin/bash -x

umount /staj/vz/root/192003/mnt 2>/dev/null
vzquota off 10192003

>> Mount point /staj/vz/root/192003/mnt doesn't exist at moment of calling.
>> But when I do not call umout it hangs in system mount tab.
> 
> check -n option to mount.

Great. Thanks!

>> I'm also interested if it's posible to have inside VE df showing correct
>> info, instead of total HW node capacity.
>>
>> root@dns:/# df -h
>> Filesystem            Size  Used Avail Use% Mounted on
>> simfs                 1.0G  370M  655M  37% /
>> /dev2/root2           1.1T   46G 1020G   5% /mnt
>> tmpfs                 4.0G     0  4.0G   0% /lib/init/rw
>> tmpfs                 4.0G     0  4.0G   0% /dev/shm
> 
> have you called vzquota on on this directory?
> plz check vzquota init, on, off commands.
> you will need to assign some numerical ID to this quota directory (should be different from VEID),
> setup vzquota on it and simply turn it on before bind mount.

Yes I did initialized quota by:

# vzquota init 10192003 -p /staj/vz/private/192003.mnt -b 1000 -B 1500 
-i 100 -I 150 -e 0 -n 0

and I'm activating in mount script:

#!/bin/bash -x

vzquota on 10192003
mount -n --bind /staj/vz/private/192003.mnt /staj/vz/root/192003/mnt

It's working:

chlivek:~# vzctl enter 192003
entered into VE 192003
root@dns:/# echo "test" >/mnt/test
-bash: echo: write error: Disk quota exceeded

but df still show it as

 >> /dev2/root2           1.1T   46G 1020G   5% /mnt

which isn't very intuitive and for me as admin should be really better 
to be able hide total system capacity from my users :)

Any idea how to solve this?

-- 
-----------------------
Jan Tomasek aka Semik
http://www.tomasek.cz/
Previous Topic: Samba core dump after live migration
Next Topic: IPv6 ??
Goto Forum:
  


Current Time: Thu Mar 28 19:29:11 GMT 2024

Total time taken to generate the page: 0.01740 seconds