Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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.
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.
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.