Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Hope the question is not too general.

As I have a vserver (Ubuntu 12.04) I cannot restrict the size of directories by using quotas. I wonder if there are other possibilities to achieve this.

The only method I could imagine would be a combination of inotify + config-file where the maximum size is stated + command which, well, makes the file empty or removes it or something like this. It's not about restricting user directories but automatically written files like logfiles.
I know it's not the best way, but the only one I think would work. Do you have better ones?

share|improve this question

closed as off topic by mdpc, Ward, Scott Pack, Tim Brigham, SvW May 28 '13 at 21:10

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers 2

This won't really scale well to lots of quotas, but one simple solution would be to simply create another filesystem that has the fixed size that you want.

If you don't have any spare block storage, then you could use a loopback device pointed to a sparse file. The sparse file will not consume storage until it is being used, but if you create a filesystem on top of that sparse file it will appear to have a fixed maximum amount of storage available. Growing/shrinking will be somewhat difficult though. The safest method will be to create a new sparse file + filesystem that is larger/smaller, then transfer the contents of the old file.

share|improve this answer

If the issue is specifically log files, use a syslog daemon that supports specifying max filesize. I believe rsyslogd does that. If that's not possible, there are a number of logrotate programs that can rotate logs when they reach max filesize and keep a given number of logs only, so that the total size is kept within limits.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.