Author Topic: How to setup user quotas ?  (Read 192003 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
How to setup user quotas ?
« on: September 09, 2014, 09:59:48 PM »
Let's say that your /home partition is in / mount point

install quota on your centos
Code: [Select]
yum install quota
Edit: /etc/fstab   
Code: [Select]
vi /etc/fstab 
replace "defaults" with "usrjquota=quota.user,jqfmt=vfsv0" for / mount point

Before (in some cases this can be different!):
Code: [Select]
UUID=ac567666-9385-4ef5-885c-80f61ec64647       /       ext3    defaults        1       1After Replace:
Code: [Select]
UUID=ac567666-9385-4ef5-885c-80f61ec64647       /       ext3    usrjquota=quota.user,jqfmt=vfsv0        1       1
Code: [Select]
mount -o remount /
quotacheck -avugm
quotaon -avug



If you have /home in /etc/fstab then you will need to edit line matching /home
replace "defaults" with "usrjquota=quota.user,jqfmt=vfsv0" for /home mount point

Before:
Code: [Select]
UUID=ac567666-9385-4ef5-885c-80f61ec64647       /home       ext3    defaults        1       1After Replace:
Code: [Select]
UUID=ac567666-9385-4ef5-885c-80f61ec64647       /home       ext3    usrjquota=quota.user,jqfmt=vfsv0        1       1
Code: [Select]
mount -o remount /home
quotacheck -avugm
quotaon -avug

Now you need to add this into the CWP Configuration
Code: [Select]
mkdir -p /usr/local/cwp/.conf/
echo "/home" > /usr/local/cwp/.conf/quota_part.conf


How to check if quota works ?
Code: [Select]
repquota -a This will display you user limits

Set a quota for all users by package from cwp
Code: [Select]
/scripts/cwp_api account update_diskquota_all

If you had previously added users then you will need to update the quota for them, you can do that by clicking on each account edit and then saving changes, or you can edit packages and save them for all users.


XFS Quota (only for XFS file system!!!)
Code: [Select]
yum -y install quota quota-devel
edit file: /etc/fstab and add usrquota,grpquota example:
/dev/mapper/centos_root-home /home xfs defaults,usrquota,grpquota 0 0

before example
Code: [Select]
/dev/mapper/centos_root-home /home xfs defaults 0 0aftere example
Code: [Select]
/dev/mapper/centos_root-home /home xfs defaults,usrquota,grpquota 0 0
Activate quota as XFS for /home
in CWP.admin go to Left Menu -> Server Settings --> Disk Quota , and set
Quota Partition: /home
Quota Type: xfs

reboot the server

Next, activate quota for all accounts
in cwp.admin go to Left Menu -> Packages -> List Packages
edit all packages you have and select "Update Quota" to set the quota for all accounts using this package.

How to check if /home is mounted with quota
Code: [Select]
mount |grep homeif you have there listed usrquota,grpquota for /home then all should work fine.
=============
XFS: In some cases, you would also need to modify grub conf if the above fails

Code: [Select]
# mount | grep ' / '
/dev/mapper/cl-root on / type xfs (rw,relatime,attr2,inode64,noquota)


 If you see "noquota" in the xfs mount options for the / partition then you would need to modify file: /etc/default/grub
Find the line with the variable "GRUB_CMDLINE_LINUX" and at end of the line add: "rootflags=uquota,pquota"

Example:
Code: [Select]
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=cl/root rd.lvm.lv=cl/swap rhgb quiet rootflags=uquota,pquota"
Make backup and create grub config for boot
Code: [Select]
cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.orig
grub2-mkconfig -o /boot/grub2/grub.cfg
echo xfs > /usr/local/cwp/.conf/quota_type.conf

now reboot the server
Code: [Select]
reboot
after reboot run API to set quota for all users
Code: [Select]
/scripts/cwp_api account update_diskquota_all
Note: If you want emails and user home to be under the same quota then /var/vmail and /home need to be on the same partition.
« Last Edit: March 18, 2022, 09:25:34 AM by Administrator »
AntiDDoS Protection (web + mail)
http://centos-webpanel.com/website-ddos-protection-proxy

Join our Development Team and get paid !
http://centos-webpanel.com/develope-modules-for-cwp


Services Monitoring & RBL Monitoring
http://centos-webpanel.com/services-monitor


Do you need Fast and FREE Support included for your CWP linux server?
http://centos-webpanel.com/noc-partner-list
Installation Instructions
http://centos-webpanel.com/installation-instructions
Get Fast Support Here
http://centos-webpanel.com/support-services

Offline
*
Re: How to setup user quotas ?
« Reply #1 on: September 10, 2014, 01:11:33 PM »
Hello, I had install my CentOS Web Panel and I config Quota like said here. Now I create a Domain and I´m traying to upload an archive.

In the FileZilla, give me an error and its create me a file with 0K of space.

Any Help?

Offline
*
Re: How to setup user quotas ?
« Reply #2 on: September 10, 2014, 05:05:26 PM »
login to user panel and check quota usage
AntiDDoS Protection (web + mail)
http://centos-webpanel.com/website-ddos-protection-proxy

Join our Development Team and get paid !
http://centos-webpanel.com/develope-modules-for-cwp


Services Monitoring & RBL Monitoring
http://centos-webpanel.com/services-monitor


Do you need Fast and FREE Support included for your CWP linux server?
http://centos-webpanel.com/noc-partner-list
Installation Instructions
http://centos-webpanel.com/installation-instructions
Get Fast Support Here
http://centos-webpanel.com/support-services

Offline
*
Re: How to setup user quotas ?
« Reply #3 on: November 14, 2014, 05:41:05 PM »
Hi,
My /etc/fstab only has these records in it:

none    /dev/pts        devpts  rw,gid=5,mode=620       0       0
none    /dev/shm        tmpfs   defaults                0       0

I can't seem to find the / mount point. The above is the only contents of the file.

Offline
*
Re: How to setup user quotas ?
« Reply #4 on: November 18, 2014, 12:40:00 AM »
on the OpenVZ VPS servers you should contact your hosting provider to do that for you.
AntiDDoS Protection (web + mail)
http://centos-webpanel.com/website-ddos-protection-proxy

Join our Development Team and get paid !
http://centos-webpanel.com/develope-modules-for-cwp


Services Monitoring & RBL Monitoring
http://centos-webpanel.com/services-monitor


Do you need Fast and FREE Support included for your CWP linux server?
http://centos-webpanel.com/noc-partner-list
Installation Instructions
http://centos-webpanel.com/installation-instructions
Get Fast Support Here
http://centos-webpanel.com/support-services

Offline
*
Re: How to setup user quotas ?
« Reply #5 on: November 18, 2014, 08:50:38 AM »
I am my hosting provider. I own the whole dedicated server. Are you saying I should install it on the host server?
I have root access to both the vps and the dedicated server.

Offline
*
Re: How to setup user quotas ?
« Reply #6 on: November 18, 2014, 11:49:19 PM »
AntiDDoS Protection (web + mail)
http://centos-webpanel.com/website-ddos-protection-proxy

Join our Development Team and get paid !
http://centos-webpanel.com/develope-modules-for-cwp


Services Monitoring & RBL Monitoring
http://centos-webpanel.com/services-monitor


Do you need Fast and FREE Support included for your CWP linux server?
http://centos-webpanel.com/noc-partner-list
Installation Instructions
http://centos-webpanel.com/installation-instructions
Get Fast Support Here
http://centos-webpanel.com/support-services

Offline
*
Re: How to setup user quotas ?
« Reply #7 on: November 23, 2014, 09:32:21 PM »
Should we enable journalled quota ?

at hardware level secondary quota enabled but still this is the output
Filesystem      Size  Used Avail Use% Mounted on
/dev/simfs       60G  3.5G   57G   6% /
none            512M  4.0K  512M   1% /dev
[root@s2 ~]# mount -o remount /
mount: permission denied

[root@s2 ~]# quotacheck -avugm
quotacheck: Your kernel probably supports journaled quota but you are not using it. Consider switching to journaled quota to avoid running quotacheck after an unclean shutdown.
quotacheck: Quota for users is enabled on mountpoint / so quotacheck might damage the file.
Please turn quotas off or use -f to force checking.

Offline
*
Re: How to setup user quotas ?
« Reply #8 on: November 23, 2014, 11:43:31 PM »
for openvz system you need to contact your hosting provider.
AntiDDoS Protection (web + mail)
http://centos-webpanel.com/website-ddos-protection-proxy

Join our Development Team and get paid !
http://centos-webpanel.com/develope-modules-for-cwp


Services Monitoring & RBL Monitoring
http://centos-webpanel.com/services-monitor


Do you need Fast and FREE Support included for your CWP linux server?
http://centos-webpanel.com/noc-partner-list
Installation Instructions
http://centos-webpanel.com/installation-instructions
Get Fast Support Here
http://centos-webpanel.com/support-services

Offline
***
Re: How to setup user quotas ?
« Reply #9 on: December 16, 2014, 07:03:59 AM »
Related to OpenVZ, the first check we have to do is change another's fresh user account the try to write disk.

If you can write disk with ANY user you have not reach OpenVZ container and it's your server problem/missconfiguration. If you reach global Container limits, you can write at all, plus the VPS can shutdown due to that and restart in recovery mode.

A example to write test can be using dd, by creating dummy file:
dd if=/dev/urandom of=delete-me bs=128M count=1; sync; rm -f delete-me; echo "Test finished. File removed.";

This will write 128Mb of random content and show you statistitcs.

Regards.
8==D it's a function that try to compare 8 (int) against D (string) which returns True or False depending on the asker.

Offline
*
Re: How to setup user quotas ?
« Reply #10 on: December 30, 2014, 10:49:47 AM »
I had the quota installed and set the necessary settings on /etc/fstab, but sometimes when restarted the server and re-login onto CWP it showed the quota notification again.

How can I set the quota permanently onto the server??

Quote
[root@server ~]# ll /dev/root
ls: cannot access /dev/root: No such file or directory
[root@server ~]# ln -s /dev/xvda /dev/root
[root@server ~]# ll /dev/root
lrwxrwxrwx 1 root root 9 Dec 30 10:37 /dev/root -> /dev/xvda
[root@server ~]# mount -o remount /
[root@server ~]# quotacheck -avugm
quotacheck: Scanning /dev/root [/] done
quotacheck: Old group file name could not been determined. Usage will not be substracted.
quotacheck: Checked 11062 directories and 110366 files
[root@server ~]# quotaon -avug
/dev/root [/]: user quotas turned on

Offline
*
Re: How to setup user quotas ?
« Reply #11 on: January 01, 2015, 03:46:47 PM »
what is the output of:
df -h
cat /etc/fstab
AntiDDoS Protection (web + mail)
http://centos-webpanel.com/website-ddos-protection-proxy

Join our Development Team and get paid !
http://centos-webpanel.com/develope-modules-for-cwp


Services Monitoring & RBL Monitoring
http://centos-webpanel.com/services-monitor


Do you need Fast and FREE Support included for your CWP linux server?
http://centos-webpanel.com/noc-partner-list
Installation Instructions
http://centos-webpanel.com/installation-instructions
Get Fast Support Here
http://centos-webpanel.com/support-services

Offline
*
Re: How to setup user quotas ?
« Reply #12 on: January 09, 2015, 11:59:53 PM »
What about KVM? I didn't understood what should I replace as I don't have
Code: [Select]
UUID=ac567666-9385-4ef5-885c-80f61ec64647       /       ext3    defaults        1       1or
Code: [Select]
mount -o remount /
quotacheck -avugm
quotaon -avug

I'm using KVM Vps server.
Sorry for my English :(

Offline
*
Re: How to setup user quotas ?
« Reply #13 on: February 02, 2015, 02:21:05 PM »
Can someone do a YouTube video of how to do this?  ;D It would help me a bunch!
Trying to help people :)
Chords and Lyrics

Offline
*
Re: How to setup user quotas ?
« Reply #14 on: February 04, 2015, 02:20:12 AM »
new version will have quota setup script to do this automatically for you.
AntiDDoS Protection (web + mail)
http://centos-webpanel.com/website-ddos-protection-proxy

Join our Development Team and get paid !
http://centos-webpanel.com/develope-modules-for-cwp


Services Monitoring & RBL Monitoring
http://centos-webpanel.com/services-monitor


Do you need Fast and FREE Support included for your CWP linux server?
http://centos-webpanel.com/noc-partner-list
Installation Instructions
http://centos-webpanel.com/installation-instructions
Get Fast Support Here
http://centos-webpanel.com/support-services