Friday, February 04, 2005

Had to do some serious hacking for our internal python disk quota module (written in C) to get it to work with the new disk quota system. There are so many iterations of this subsystem in Linux it was crazy. After a lot of hair pulling I've got it working, and I might slowly document it below.

This is on a SuSE 9.1 system running the 2.6.5 linux kernel. I'm using Python 1.5.2 just because the python module uses the old python API, and we dont want to update that for now (I would love to, but no time at the moment).

First of you have to enable the disk quota system on your system.
The file system that I had to set the disk quota on was /usr (/dev/hda1).
To do that I had to edit the /etc/fstab file so that the /usr partition entry had the additional values of usrquota,grpquota.

/dev/hda1 /usr ext3 acl,user_xattr,usrquota,grpquota 1 1


Then I ran quotacheck.

Once the quota system is on, you have to edit the user or group quota settings. In this case, I setup the user quota settings.

edquota adnanw


This will open up quota file in an editor where you can edit the hardlimit and softlimits etc.

Running "quota adnanw" will give the following:
Disk quotas for user adnanw (uid 201):
Filesystem blocks quota limit grace files quota limit grace
/dev/hda1 49340 250000 0 49 0 0


After this step I compiled the perl disk quota module. I was planning to study it to see what changes I have to make to the python module. Running a make test on the perl module caused the system to not find any quota settings for the user adnanw. That was weird so after some googling I found that you have to specifically do a quotaon to get the perl module to work.

quotaon -v -a


Now the perl module worked.

linux:/home/adnan/Quota-1.5.0 # make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-Iblib/lib" "-Iblib/arch" test.pl

Enter path to get quota for (NFS possible; default '.'): /usr
Using device/argument "/dev/hda1"
Quotas are present on this filesystem (sync ok)

Query this fs with default uid (which is real uid) 0
Your usage and limits are 3666984 (0,0,0) 176974 (0,0,0)

Enter a uid to get quota for: 201
Usage and limits for 201 are 49340 (250000,0,0) 49 (0,0,0)


Now come the changes I had to make to the old quota.c so that it would work with the new Linux kernel.

Mozilla and hypocrisy

Right, but what about the experiences that Mozilla chooses to default for users like switching to  Yahoo and making that the default upon ...