4

We have an issue where cache and another script just ate our server away making it un-bootable. I believe Windows or Mac OS X would never allow this. After having read "Server logs are filling my hard disk, how do I fix this?" I still need a solution.

Say that a custom script is set to run as root. If that script goes berserk it could output a file that grows and grows on the server until there is no more space available. Even overwriting system files.

Is there any way to ensure that root, or any process on a system from any user, never fill the hard disk to capacity?

3
  • What sort of script? (bash, python, etc) N.B. Probably wrong with the Windows thing... I have operated Windows on a tiny partition, and had many issues with programs trying more space than there is available.
    – Wilf
    Aug 11, 2014 at 21:35
  • You say "even overwriting system files". Could you show us some evidence?
    – waltinator
    Aug 11, 2014 at 22:32
  • 1
    Root can do whatever it wants, which is the whole point of root. Run it as a different user and give privileges it needs. OSX is also Unix, which means its root user can do whatever it wants. Windows' administrator users are much less powerful.
    – muru
    Aug 12, 2014 at 10:25

2 Answers 2

1

A "Custom script is set to run as root" sounds risky. Are you sure it must be?

You could create another partition, and have the script write output there. Then, it will only fill that partition, and the script will fail without troubling the system.

While the script is running (running away) use lsof (See man lsof for details) to see which file(s) is/are growing, seemingly without bound. Then, fix the script.

0

You can use user "quota" to limit the amount of space a user takes on disk. Then you can run the script as that user.

2
  • Can the downvoter please let me know why it was downvoted?
    – Apoorv
    Apr 13, 2017 at 21:52
  • One possible reason for down voting: you don't tell how to perform what you are suggesting.
    – guntbert
    Apr 14, 2017 at 6:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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