DirectAdmin ZFS wrappers [user quota]

roman_m

Verified User
Joined
May 5, 2005
Messages
130
Location
Ukraine, Kiev
HOWTO: DirectAdmin ZFS user quota wrappers

Since DA has no native ZFS supoprt and no solitions proposed in forum, I made custom wrappers.

To use it, you have to create bin folder in /usr/local/directadmin and put two attached scripts from archive (repquota, edquota) into it, then chown it both to root:wheel and made it executable. Wrappers written in perl, so you must install perl from pkg repository.

Also, you need to set $volume variable in both scripts to point to your /home filesystem (t0/home in my case) and some variables in directadmin.conf to point DA to use this wrappers:

edquota=/usr/local/directadmin/bin/edquota
repquota=/usr/local/directadmin/bin/repquota

You can use attached fix_user_quotas.pl to synchronize actual DA user quota settings with your new filesystem.

And ... Enjoy sophisticated DirectAdmin on ZFS :)

Currently running one box on ZFS with FreeBSD 9.3-RELEASE, works exactly the same as UFS DA installation, but with SSD L2ARC cache that's really like a lightspeed!
 

Attachments

Last edited:

roman_m

Verified User
Joined
May 5, 2005
Messages
130
Location
Ukraine, Kiev
Good news!
I think, they could use my wrappers to rewrite and compile internal code into DA binary.
DA with native ZFS support - that was a really cool thing!

Wishing all the best to DA Staff.
 

SeLLeRoNe

Super Moderator
Joined
Oct 9, 2004
Messages
6,791
Location
A Coruña, Spain
As far as John told me they already had implemented quota check with ZFS so i suppose they are in an advanced status.

Regards
 

interfasys

Verified User
Joined
Oct 31, 2003
Messages
2,099
Location
Switzerland
As far as John told me they already had implemented quota check with ZFS so i suppose they are in an advanced status.
I don't think it's true. repquota does not work, the numbers are all wrong in the CP and emails about overage are never sent.

But thanks to @roman_m, this can all be fixed!!! MANY THANKS!!!

HOW-TO (as root)

Install scripts
Code:
# cd /usr/local/directadmin/
# mkdir /usr/local/directadmin/bin
# cd /usr/local/directadmin/bin
# fetch http://forum.directadmin.com/attachment.php?attachmentid=1881&d=1406381242
# unzip zfs_wrappers.zip
# chown :wheel /usr/local/directadmin/bin/repquota
# chown :wheel /usr/local/directadmin/bin/edquota
# chmod +x /usr/local/directadmin/bin/repquota
# chmod +x /usr/local/directadmin/bin/edquota
# echo "edquota=/usr/local/directadmin/bin/edquota" >> /usr/local/directadmin/conf/directadmin.conf
# echo "repquota=/usr/local/directadmin/bin/repquota" >> /usr/local/directadmin/conf/directadmin.conf
Update and fix scripts
Code:
# nano /usr/local/directadmin/bin/edquota
Replace the name of your ZFS volume holding your users' files in the $volume variable
Replace $slice with $volume in the zfs command, line 14
# nano /usr/local/directadmin/bin/repquota
Replace the name of your ZFS volume holding your users' files in the $volume variable
Enforce quotas and check
Code:
# chmod +x fix_quotas.pl
# ./fix_quotas.pl
# /usr/local/directadmin/bin/repquota `/usr/local/directadmin/directadmin c | grep quota_partition= | cut -d= -f2`
After that you'll need to update the reports for all of your users and you might be in for a few surprises...
Code:
echo "action=tally&value=all" >> /usr/local/directadmin/data/task.queue
 

roman_m

Verified User
Joined
May 5, 2005
Messages
130
Location
Ukraine, Kiev
You also need to fix line 9 in `edquota` script, replacing line
my $quota = $AR[1];
with
my $quota = $ARGV[1];

It's my typo, sorry.
 

roman_m

Verified User
Joined
May 5, 2005
Messages
130
Location
Ukraine, Kiev
Here is new (fixed) version

Fixed version of wrappers (no need to modify scripts excluding seting of $volume variable).

Also includes `quota` command, not used by DirectAdmin, but very useful as system-wide `quota` command wrapper.
It produces same output as standart *nix `quota` binary, just put it into /usr/local/directadmin/bin then
chown :wheel /usr/local/directadmin/bin/quota
chmod 711 /usr/local/directadmin/bin/quota
cp /usr/bin/quota /usr/bin/quota.backup
ln -s /usr/local/directadmin/bin/quota /usr/bin/quota

test:
#quota root
Disk quotas (kilobytes) for user root (uid 0): none

#quota diradmin
Disk quotas (kilobytes) for user diradmin (uid 1001):
Filesystem usage quota limit
/home 0 300 300

View attachment zfs_wrappers.zip
 

Ronnie

Verified User
Joined
Oct 11, 2007
Messages
8
Disk usage not working

Hello,

Thanks for this great contribution.
Al the scripts are working fine, however the disk usage reporting in Directadmin is not working.
It show's only the database size, and not the actual size of the website.

I already tried, to re-run the tally several times.

Is there anything else that i'm missing?

Best regards,

Ronnie
 
Top