About this list Date view Thread view Subject view Author view Attachment view

From: Darryl Ross (spam_at_afoyi.com)
Date: Sat 07 May 2005 - 01:06:21 BST

Hash: SHA1

acc_at_actserv.net wrote:

> THE PROBLEM IS : how , in the name of god, can i limit a vps , to use
> only for instance 1GB, and not take the whole Hd of the host? i saw
> those quota stuff, tried to patch it on 2.4.30 kernel, and rebuild it -
> but its failed. i need some howto/good explain how, in a simple honest
> to god way, to achive my little request: LIMITING HD SPACE FOR A VPS.
> thats it. otherwise all good.

Well, the way I do it, which is probably not the recommended way, is to
create a file that is the maximum size I want the vserver to be, create
a file system on it and then loopback mount the file to where the
vserver directory would be.

A different way would be to create a separate LVM partition(?) for each
vserver. I didn't go that way because the machine was already running
and I've had bad experiences with LVM in the past.

==== Start Example ====================================================

[root_at_vserver1 ~]# cd /vservers/0IMAGES/
[root_at_vserver1 0IMAGES]# dd if=/dev/zero of=demo.img bs=1M count=1024
1024+0 records in
1024+0 records out
[root_at_vserver1 0IMAGES]# mkfs.ext2 demo.img
mke2fs 1.36 (05-Feb-2005)
demo.img is not a block special device.
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
131072 inodes, 262144 blocks
13107 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376

Writing inode tables: done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root_at_vserver1 0IMAGES]# vi /etc/fstab
[root_at_vserver1 0IMAGES]# cat /etc/fstab | grep demo
/vservers/0IMAGES/demo.img /vservers/demo ext2 loop 0 0
[root_at_vserver1 0IMAGES]# mount /vservers/demo
[root_at_vserver1 0IMAGES]#

==== End Example ======================================================

This method requires more overhead than using quotas (double the disk
access required for one thing - once to flush to the loopback device and
then again to flush the loopback device to the actual device) although I
can still saturate a 100Mbps network with a P3-1GHz and 2x 40Gb IBM
drives in a RAID1.

"Hard" quotas without having to worry about proper quota support and it
is relatively easy to set up.

Hope that gives you some ideas.


Version: GnuPG v1.2.1 (MingW32)

Vserver mailing list

About this list Date view Thread view Subject view Author view Attachment view
[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Sat 07 May 2005 - 01:06:35 BST by hypermail 2.1.3