MRatWork Forum by Mustafa Ramadhan
Sawo Project - Kloxo-MR Discussions => Kloxo-MR Technical Helps => Topic started by: Spacedust on 2013-04-22, 17:32:49
-
Mustafa you made a huge mistake in this file. Leaving disk usage count to work only on linux installations using english language only.
-
You disabled this:
$rt = lxshell_output("du", "-sc", $path);
$os = preg_replace("/s+/", ":", $rt);
$ret = explode(":", $os);
$t = $ret[2];
and replaced this with non-working code if Linux installation is installed in different language than English !
exec("du -sc {$path} | grep -i 'total'", $out);
$os = preg_replace("/s+/", ":", $out[0]);
$t = str_replace(":total", "", $os);
Take a look:
[root@nowosci /]# du -sc /home/admin
100544 /home/admin
100544 razem
So there is no word total !
[root@nowosci /]# du -sc /home/admin | grep total
[root@nowosci /]#
That's why Kloxo isn't counting quota properly on so many systems, because we use polish on all of them !
-
It will be very easy to switch to quotas now - see example:
quota -u monia_mal
Disk quotas for user monia_mal (uid 2117):
System plików bloki mi?kki twardy pob?. pliki mi?kki twardy pob?.
/dev/root 28 52428800 52428800 79 0 0
/dev/md2 33699544 52428800 52428800 312604 0 0
We should just use du -sc for mail and databases and use quota for /home.
This will give us realtime disk usage at least for /home.
-
Look like need modified as:
exec("du -sc {$path} | grep -i '{$path}'", $out);
$os = preg_replace("/s+/", ":", $out[0]);
$t = str_replace(":total", "", $os);
-
Look like need modified as:
exec("du -sc {$path} | grep -i '{$path}'", $out);
$os = preg_replace("/s+/", ":", $out[0]);
$t = str_replace(":total", "", $os);
Yes it works ok on polish linux. But this is only a temporary solution which takes almost 4 hours to count on our filesystem and causing very high I/O load. We must use quota -u as soon as possible.
-
Using 'quota -u' not work in my servers
-
Using 'quota -u' not work in my servers
Make sure you use add "usrjquota=aquota.user,grpjquota=aquota.group,usrquota,grpquota" to each entry you want quotas in /etc/fstab:
proc /proc proc defaults 0 0
none /dev/pts devpts gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs defaults 0 0
/dev/md0 /boot ext3 defaults 1 1
/dev/md1 / ext4 rw,discard,noatime,nodiratime,usrjquota=aquota.user,grpjquota=aquota.group,usrquota,grpquota,jqfmt=vfsv0 1 1
/dev/md2 /home ext4 rw,noatime,nodiratime,usrjquota=aquota.user,grpjquota=aquota.group,usrquota,grpquota,jqfmt=vfsv0 0 0
/dev/md3 /var/lib/mysql ext4 rw,discard,noatime,nodiratime,usrjquota=aquota.user,grpjquota=aquota.group,usrquota,grpquota,jqfmt=vfsv0 1 1
/root/swapfile1 swap swap defaults 0 0
Then reboot to remount all partition.
Then run /script/fixquota and all will work ok.
-
@Spacedust,
A problems is most servers (especially vps) not using quota for partitions. Using 'quota -u' need modified partition config and it's make more difficult rather then using 'du -sc'.
-
@Spacedust,
A problems is most servers (especially vps) not using quota for partitions. Using 'quota -u' need modified partition config and it's make more difficult rather then using 'du -sc'.
All servers should use quotas. What's the problem to add these entries during Kloxo install ?
You can then remount partitions with:
remount -o /dev/<partitionname>
No need to reboot. cPanel and DirectAdmin are using quotas so I don't know what's the problem.
If you dislike quotas then please make a second version with du -sc and use it by default. We won't use du -sc because it's overloading our servers.
Imagine what would happens if you run it on a 16 TB array. It would take ages to complete.
If you won't use quotas then your users are able to use more disk space than they're allowed so this is a big security problem.
-
Sorry, a typo:
mount -o remount /dev/<partitionname>
Then you should see something like this inside dmesg:
EXT4-fs (md1): re-mounted. Opts: discard,usrjquota=aquota.user,grpjquota=aquota.group,usrquota,grpquota,jqfmt=vfsv0
-
Try with:
// exec("du -sc {$path} | grep -i '{$path}'", $out);
exec("du -s {$path}", $out);
$os = preg_replace("/s+/", ":", $out[0]);
$t = str_replace(":{$path}", "", $os);
-
Try with:
// exec("du -sc {$path} | grep -i '{$path}'", $out);
exec("du -s {$path}", $out);
$os = preg_replace("/s+/", ":", $out[0]);
$t = str_replace(":{$path}", "", $os);
Work ok for me, but maybe we should use ionice -c2 before this command to reduce I/O load ?
How these lines should look if I want to use quota ?
-
Yes. this function 'lxfile_dirsize($path, $byteflag = false)' need 'path'.
If using 'quota -u', need new function like 'lxfile_quotasize($user, $byteflag = false)'.
-
Yes. this function 'lxfile_dirsize($path, $byteflag = false)' need 'path'.
If using 'quota -u', need new function like 'lxfile_quotasize($user, $byteflag = false)'.
Can you write one for testing purposes ?
-
Mustafa do something about this. It's overloading our servers !!!
Here's load average from last night:
(http://imageshack.us/a/img197/2788/1load1.png)
-
To get quota running on particular customer you have to create client with Resource Package and limited disk space for example to 50 GB.
-
Here you've got tutorial how to enable quota: http://www.yolinux.com/TUTORIALS/LinuxT ... uotas.html (http://www.yolinux.com/TUTORIALS/LinuxTutorialQuotas.html)
It works fine on my VPS:
[root@nowosci /]# quota -u testclient Ograniczenia dyskowe user testclient (uid 7798):
System plików bloki mi?kki twardy pob?. pliki mi?kki twardy pob?.
/dev/root 100256 51200000 51200000 34 0 0
-
My temporary solution:
exec("ionice -c2 -n7 du -s {$path}", $out);
$os = preg_replace("/s+/", ":", $out[0]);
$t = str_replace(":{$path}", "", $os);
-
Look how this is made inside DirectAdmin:
http://forum.directadmin.com/showthread ... #post51071 (http://forum.directadmin.com/showthread.php?t=8818&p=51071#post51071)
-
I will use your 'ionice -c2 -n7' code.
For quota, it's not easy because need overhaul the code related to diskuse.
-
I will use your 'ionice -c2 -n7' code.
For quota, it's not easy because need overhaul the code related to diskuse.
We will have to do this anyway in future. I will be testing the new command tonight.
-
I found another bug !
Go to admin home -> select domains -> choose domains -> TotDisk is always 0 !
(http://img836.imageshack.us/img836/6609/aaaabl.jpg)
-
Look like certain codes unfinished by Ligesh. So, need more time to investigate dirsize codes.
-
Look like certain codes unfinished by Ligesh. So, need more time to investigate dirsize codes.
He propably wanted to add quota disk usage anyway. What would be the reason to integrate quotas directly inside Kloxo ? Try to do tail -f /usr/local/lxlabs/kloxo/shell_exec and then add customer with Resource Plan - you will see setquota command ;)
-
This is still causing our servers to overload. This can't stay that way !
-
Mustafa please write this function ASAP and I will donate this project !
-
I'm getting somewhere:
exec("quota -u testclient | tail -1 | awk '{print $2}'", $out);
$os = preg_replace("/s+/", ":", $out[0]);
$t = str_replace(":{$user}", "", $os);
This is reporting correctly, but all values for mail, mysql and web are the same.
First I need to replace testclient with $user then add additional function to use quota for web usage only.
-
I will use your 'ionice -c2 -n7' code.
Please use ionice -c3 -n7 at least ! This is the lowest priority.
-
Our developer will create quota for Kloxo-MR.