Standard non-shared quota

From Linux-VServer

Revision as of 17:46, 1 June 2009 by Skaboom (Talk | contribs)

Jump to: navigation, search

Want to enable quotas from within a vserver, nothing special, just plain old and good quota support? Then this might help you! First things first, you will need a vserver enabled kernel that you have made working and you need to add vroot support to it (In menuconfig it is in Device Drivers → Block Devices → Virtual Root device support).

After booting on the vroot enabled vserver kernel, you should have a directory /dev/vroot/ with 8 vroot devices (0-7) you can use to set up your quota, if you don't, then you may make them by mknod /dev/vroot/n b 4 n (where n can be from 0 to 7). If your Linux distribution uses udev, these will be at /dev/vroot[0-7] instead.


Initial Setup

First, ensure that the filesystem where your vservers are located on the host has quota options enabled: usrquota,grpquota

Edit your /etc/fstab if this is not the case. You don't need to actually enable quotas in the host, but you at least need the usrquota and grpquota mount options.

Then, use vrsetup to tell the kernel what block device you want to handle quota for:

vrsetup /dev/vroot/0 [partition]

Where [partition] is your /vservers partition. For example, this could be something like /dev/hda5 if you're just using standard partitioning, or something like /dev/lvm/vserver0 if you're using LVM.

Setting Up Vservers For Quota

Setting up the vserver for quota is straight forward: (you need util-vserver 30.208 or newer)

1. Create a default mtab for the guest. To do this, add:

/dev/hdv1 / ufs rw,usrquota,grpquota 0 0

to /etc/vservers/<name>/apps/init/mtab

Note: Replace ufs with xfs if you're using an XFS file-system.

2. Add the quota capability to the guest vserver. Add:


to /etc/vservers/<name>/ccapabilities

3. Copy the vroot device which we setup earlier to the vserver:

cp -af /dev/vroot/0 /vservers/<name>/dev/hdv1

Finishing the setup

1. Start your guest.
2. Inside the guest, make sure the mtab entry is present:

grep /dev/hdv1 /etc/mtab
/dev/hdv1 / ufs rw,usrquota,grpquota 0 0

Afterwards run

quotacheck -maugv

3. Still inside the guest, turn quotas on.

Save settings for reboot

To have setting persist on reboot, put vrsetup line into /etc/init.d/util-vserver start function, so after reboot vroot device get setup before it start.

Personal tools