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

I have some programs on a server (Centos4-OpenVZ) that use a directory as temp directory - but pay no attention to the size as it grows.

I want to enforce a limit, such as that this folder cannot exceed 300MB.

I would use quota but OpenVZ does not support loop devices, that could be used to mount a file as a device.

Any other solutions? (Apart from scripting a periodic delete of files in the directory).

Editing the application's code to implement this functionality is not entirely out of the question (if it can be done easily and no other ways exist it's written in cpp) but I don't know where I would start if going that route.

share|improve this question

2 Answers 2

What about mounting the filesystem inside your OpenVZ environment using NFS? Then you can implement quotas on the NFS server (which may be the same machine running OpenVZ).

share|improve this answer
    
That's an intersting idea, hadn't thought of that. Looking now about how it can be done.. Not sure about the overhead of that solution though, running the nfs server on the same machine etc. It's one way to do it sure :) –  George Jun 28 '11 at 2:19

You could use your idea of using loop devices, but you would need to mount them on the HN first like this:

losetup somefile
mount -t auto -o rw somefile /mnt/mpoint
mount -n --bind /mnt/mpoint /vz/private/101/opt

I'm not sure if you can use the vzquota command for a similar purpose. Maybe somebody who knows more about it can comment.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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