Editing
Standard non-shared quota
From Linix VServer
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
<div id="content"> <span id="top"></span> <span id="firstHeading"></span> = Standard non-shared quota = <div id="bodyContent"> <span id="siteSub"></span> === From Linux-VServer === <div id="contentSub"> </div> <div id="jump-to-nav"> Jump to: [[#column-one|navigation]], [[#searchInput|search]] </div> <div id="mw-content-text" class="mw-content-ltr" dir="ltr" lang="en"> 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. {| id="toc" class="wikitable toc" |- | <div id="toctitle"> <span id="contents"></span> == Contents == </div> * [[#Initial_Setup|<span class="tocnumber">1</span> <span class="toctext">Initial Setup</span>]] * [[#Setting_Up_Vservers_For_Quota|<span class="tocnumber">2</span> <span class="toctext">Setting Up Vservers For Quota</span>]] ** [[#Finishing_the_setup|<span class="tocnumber">2.1</span> <span class="toctext">Finishing the setup</span>]] ** [[#Save_settings_for_reboot|<span class="tocnumber">2.2</span> <span class="toctext">Save settings for reboot</span>]] * [[#New_Quotatool_since_debian_squeeze|<span class="tocnumber">3</span> <span class="toctext">New Quotatool since debian squeeze</span>]] |} <span id="initial-setup"></span> == <span id="Initial_Setup" class="mw-headline"> Initial Setup </span> == 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. Something like this will work on host machine: /etc/fstab <pre> /dev/md0 /var/lib/vservers reiserfs defaults,usrquota,grpquota 0 0</pre> <br /> Then, use ''vrsetup'' to tell the kernel what block device you want to handle quota for: <pre>vrsetup /dev/vroot0 [partition]</pre> 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. <span id="setting-up-vservers-for-quota"></span> == <span id="Setting_Up_Vservers_For_Quota" class="mw-headline"> Setting Up Vservers For Quota </span> == 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: <pre>/dev/hdv1 / ufs defaults,usrquota,grpquota 0 0</pre> to '''/etc/vservers/<name>/apps/init/mtab''' Note: Replace <code>ufs</code> with <code>xfs</code> if you're using an XFS file-system. 2. Add the quota capability to the guest vserver. Add: <pre>quota_ctl </pre> to '''/etc/vservers/<name>/ccapabilities''' 3. Copy the vroot device which we setup earlier to the vserver: <pre>cp -af /dev/vroot0 /vservers/<name>/dev/hdv1</pre> <span id="finishing-the-setup"></span> === <span id="Finishing_the_setup" class="mw-headline"> Finishing the setup </span> === 1. Start your guest.<br /> 2. Inside the guest, make sure the mtab entry is present: <pre> grep /dev/hdv1 /etc/mtab</pre> <pre> /dev/hdv1 / ufs defaults,usrquota,grpquota 0 0</pre> Add to /etc/rc.local <pre> /sbin/quotacheck -maugv /sbin/quotaon /dev/hdv1 </pre> <br /> '''"Setquota / " problem:''' <pre> Changing disk quota .. .. Administration user failed! : setquota: Mountpoint (or device) / not found. setquota: Not all specified mountpoints are using quota. at ../web-lib-funcs.pl line 1323. or: Failed to create virtual server : setquota: Mountpoint (or device) / not found. setquota: Not all specified mountpoints are using quota. </pre> '''Solution:''' Virtualmin will fail setting user quota as it requests / instead of /dev/hdv1 partition, so if you are running virtualmin - create wrapper for setquota program: <pre> if [ -f /usr/sbin/setquota-old ] then echo "Nothing to do." else mv /usr/sbin/setquota /usr/sbin/setquota-old cat > /usr/sbin/setquota <<EOF #!/bin/bash var=$* /usr/sbin/setquota-old ${var/\/}/dev/hdv1 EOF chmod +x /usr/sbin/setquota fi</pre> <span id="save-settings-for-reboot"></span> === <span id="Save_settings_for_reboot" class="mw-headline"> Save settings for reboot </span> === 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. Alternatively add the vrsetup line to the '''/etc/vservers/<vserver-name>/scripts/initialize''' script: <pre> # set quota /bin/rm -f /var/lib/vservers/<vserver-name>/dev/hdv1 /usr/sbin/vrsetup /dev/vroot0 [partition] #/dev/md0 or smth... /bin/cp -fa /dev/vroot0 /var/lib/vservers/<vserver-name>/dev/hdv1</pre> and the vrsetup detach command into '''/etc/vservers/<vserver-name>/scripts/postpost-stop''': <pre> #remove quota /usr/sbin/vrsetup -d /dev/vroot0</pre> <br /> <span id="new-quotatool-since-debian-squeeze"></span> == <span id="New_Quotatool_since_debian_squeeze" class="mw-headline"> New Quotatool since debian squeeze </span> == Since the debian squeeze the quota tool are shipped with a new version where the setup of /dev/hdvx will not work. To make it work with those tools you must: - never use hide_mounts capabilities - name the virtual device inside the guest the same name as the real one. So the mtab should have the real device name and /dev/vrootx should be copied to /vservers/guestxx/dev/realdevicename and not /dev/hdvx </div> <div class="printfooter"> Retrieved from "http://wiki.linux-vserver.org/index.php?title=Standard_non-shared_quota&oldid=5182" </div> <div id="catlinks" class="catlinks"> <div id="mw-normal-catlinks" class="mw-normal-catlinks"> [[Special:Categories|Category]]: * [[Category:Configuration|Configuration]] </div> </div> <div class="visualClear"> </div> </div> </div>
Summary:
Please note that all contributions to Linix VServer may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Linix VServer:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Page actions
Page
Discussion
Read
Edit
History
Page actions
Page
Discussion
More
Tools
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
About
Overview
Paper
News
Developers
Donations
Search
Getting Started
Downloads
FAQs
Documentation
Support
Participate
How to participate
Report a Bug
Communicate
Teams/Projects
Hall of Fame
Resources
Archives
Recent Wiki Changes
Pastebin
Related Projects
VServer Hosting
Happy VServer Users
Tools
What links here
Related changes
Special pages
Page information