LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How do i read an aquota.user file? (https://www.linuxquestions.org/questions/linux-general-1/how-do-i-read-an-aquota-user-file-800158/)

robmoser 04-05-2010 12:59 PM

How do i read an aquota.user file?
 
I'd like to actually read the contents of an aquota.user file. Partly just from curiosity, and partly because I'm having a problem where it looks like its storing the users quota in the wrong file on the wrong filesystem, and thereby causing locking problems. So if there is a way to directly translate a specific aquota.user file to readable text, or in some other way tell which aquota.user file a particular user's quota resides, I'd love to hear about it.

Not to be too preemptively paranoid, but in the interest of minimising confusion, here are a few similar questions that are NOT what I'm asking:

1) How to read a user's quotas. (quota)
2) How to set up quotas. (various, but honest; I get it.)
3) How to update aquota.user. (checkquota)
4) How to update quotas from the old format to the newer one (convertquota)

I'm specifically looking for how to actually unscramble the binary format that the aquota.user file is stored in. I've googled round about it a fair bit, but I can't seem to find a way to disambiguate the answer from all of the different answers to those other, more common ones.

Thanks for any advice,

- rob.

bakdong 04-06-2010 05:49 AM

Yes, nearly gave you the wrong answer!

So you know about edquota -u username, and repquota etc.

What you want is the format of the binary aquota.user files, stored in the root directory of the partition(s) they relate to.....


I don't know, but if I was you I would think quotactl and the associated code would be a good place to start looking.

Hope that helps.

chrism01 04-07-2010 02:44 AM

I'm pretty sure repquota is what you want http://linux.die.net/man/8/repquota. It reads that file and/or aquota.group

robmoser 04-07-2010 10:41 AM

Well, sort of...

repquota goes in, does mystical magical things to extract data from the quota file, gets a bunch of things flat-out wrong, refuses to look up some of the usernames, and outputs it all in a somewhat inconsistent format thats a pain to parse. What I'm looking for is how to do the mystical magical bit myself. What I was really hoping is that someone would say "Oh, its a Berkeley db; you can access it with any standard BDB API" - or something like that, only true.

chrism01 04-08-2010 08:28 PM

How do you know it gets things wrong (refuses to lookup user ???) ? It just reads the file & outputs results afaik.

robmoser 04-09-2010 10:36 AM

Well "wrong" may be overstating it a bit.

repquota reports on the quota for a user on the filesystem specified (or all of them, if you use -a), but:

1) It's usage information is often out of date.

2) Because of #1, it will report a user as part of a filesystem for quite awhile after the user has been moved off of the filesystem. Since moving users from one filesystem to another is what I'm currently working on, this makes its information mostly worthless.

3) It stores quotas by uid, and then looks up a username for the uid. Its doing a lot of these lookups, so its timeout appears to be quite short, and it frequently gives up and reports less than half of the entries by username, and the other half by uid. When its mixed like that, its a pain to use the data as input to any kind of automated script, and even if you force it to always use uids you have to translate them to usernames yourself.

4) It has some quirks to its output format which make it annoying for an automated script to react to; for instance, if the user is over quota, it adds an extra column into the middle of the output.


All times are GMT -5. The time now is 09:34 AM.