25

The root filesystem ran out of space, so I'm deleting all the extraneous junk. I already deleted everything in /var/log and /var/cache/apt/archives and did sudo apt autoremove.

This /var/tmp is using 18.5 GiB. What is it used for? Is it safe to delete the contents?

UPDATE

I found these 2 swap files:

474M    10112015.tgz.swp
19G     10022015.tgz.swp

Those swap files were generated by opening tar files in vi.

Is there a way to limit the amount of storage space used by /var/tmp?

2

1 Answer 1

25

Filesystem Hierarchy Standard

5.15 /var/tmp : Temporary files preserved between system reboots

5.15.1 Purpose

The /var/tmp directory is made available for programs that require temporary files or directories that are preserved between system reboots. Therefore, data stored in /var/tmp is more persistent than data in /tmp.

Files and directories located in /var/tmp must not be deleted when the system is booted. Although data stored in /var/tmp is typically deleted in a site-specific manner, it is recommended that deletions occur at a less frequent interval than /tmp.


Yes, you can remove all files in /var/tmp/.

But 18Gb is far too much. Before deleting these files do have a look at what it holds and see if you can find a culprit. Otherwise you will have it at 18Gb again soon.

6
  • 3
    As a note, a very helpful command sequence for finding the cultprit is du -sch * | sort -h in /var/tmp/, then following the last few entries.
    – Shadur
    Dec 25, 2016 at 18:51
  • @Shadur thanks for sharing command to check file sizes.
    – Raymond
    Sep 7 at 20:12
  • I had Aide*.txt files, I removed them and got almost 25% reduction in the space. Not sure what are these files.
    – Raymond
    Sep 7 at 20:13
  • @Raymond aide is a file integrity checker. Basically it checks the MD5sum of every file in the directories it's told to scan and compares the result to the previous scan, then reports back to let you know which files were modified so you can check if they should have been.
    – Shadur
    Sep 8 at 4:57
  • @Shadur thanks, so is it safe to delete all these files?
    – Raymond
    Sep 8 at 12:06

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.