If /var partition gets full on Production server then what's the solution ?

Below are my workaround:

  • If it is LVM Partition then we can extend it online.
  • We can compress logs.
  • We can remove old data.

Please suggest me more possible ways to solve and overcome this issue.

It would be helpful for me if you can share your experiences of this issue ever faced.


My approach in any of these cases (something is filling up) is first to find the culprit.

I start by using du -sh *|grep G, continue with du -sh *|grep M. When I found it I start to research why that something starts filling up.

  • Do I need that high loglevel?
  • If logs - use logrotate (/etc/logrotate.d/) even for selv-made or custom programs
  • If this a real disk-hog I try to separate it into a LV of its own

In consequence a standard Linux-disk-layout for our servers looks currently like this:

  • /var LV with 2 GB
  • /var/log LV with 8 GB
  • /var/tmp LV with 4 GB

This is currently enough for almost any use-case we have.

  • Bro, this command is a lifesaver! Thank you! – Petro Feb 16 '19 at 18:30

I once had a similar problem with a non-LVM partition that I solved by moving one of the directories to a more spacious partition and symlinking it back into place. In your case, for example, you can try:

mv /var/cache /more/spacious/partition/cache
ln -s /more/spacious/partition/cache /var/cache

Please note that I did this with a non-system directory and have so far observed no ill side effects. The case may be different with system directories, though. We need someone more knowledgeable to confirm/refute.


  • To be safer, you can do

    cp -a /var/cache /new/place/cache
    rm -rf /var/cache
    ln -s /new/place/cache /var/cache

    This ensures you won't lose your cache in case the mv call gets botched somehow (system crash, power outage,...)

  • To ensure that nothing is being written to the directory while you copy it, it's better if you do this via LiveCD.

  • I never tried this, but it might be good to do this with a Live CD, if you want to move system directories as @Joseph said. You should be careful, but it might just work ;) – Alko Aug 1 '13 at 13:53
  • @Alko you are correct, but we can check using lsof /var/cache is that used of not.. if not used that we can move to another location. – Rahul Patil Aug 1 '13 at 14:01
  • @RahulPatil and #Alko Good point. Adding to answer. – Joseph R. Aug 1 '13 at 14:04

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.