27

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?

LostSoul
  • 421
  • 1
  • 5
  • 7

1 Answers1

26

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.

Rinzwind
  • 293,910
  • 41
  • 570
  • 710
  • 4
    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 '16 at 18:51
  • @Shadur thanks for sharing command to check file sizes. – Raymond Sep 07 '22 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 07 '22 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 08 '22 at 04:57
  • @Shadur thanks, so is it safe to delete all these files? – Raymond Sep 08 '22 at 12:06
  • @Raymond *should* be, but check your aide config and logs to see why it's apparently not cleaning them up properly. – Shadur Sep 08 '22 at 12:19