Directories like /tmp/systemd-private- overflow and cause server crash due to lack of disk space

Created:

2016-12-18 06:40:18 UTC

Modified:

2017-08-11 12:57:11 UTC

5

Was this article helpful?


Have more questions?

Submit a request

Directories like /tmp/systemd-private- overflow and cause server crash due to lack of disk space

Applicable to:

  • Plesk 12.5 for Linux

Symptoms

In /tmp directory, there are sub-directories with names like:

/tmp/systemd-private-9301532e5ff749e388f365a25f51e9ea-mariadb.service-zvKlrX/tmp/ or /tmp/systemd-private-9301532e5ff749e388f365a25f51e9ea-httpd.service-HRR15v/

There are a lot of files in sub-directories in directories above and this causes lack of disk space.

Cause

Secure Tmp Systemd feature is enabled for the services mentioned in the directory names.

Resolution

There are two options.

I. Confgure the temporary files' rotation in /usr/lib/tmpfiles.d/tmp.conf :

    # Clear tmp directories separately, to make them easier to override
v /tmp 1777 root root 10d
v /var/tmp 1777 root root 30d

II. Disable Secure Tmp Systemd for the service (an example, for Mariadb):

  1. Check which services have PrivateTmp set to true :

    # grep -R PrivateTmp /etc/systemd/

    /etc/systemd/system/multi-user.target.wants/named-chroot.service:PrivateTmp=false
    /etc/systemd/system/multi-user.target.wants/php-fpm.service:PrivateTmp=true
    /etc/systemd/system/multi-user.target.wants/httpd.service:PrivateTmp=true
    /etc/systemd/system/multi-user.target.wants/mariadb.service:PrivateTmp=true
  2. Stop the service:

    # systemctl stop mariadb
  3. Change PrivateTmp value to false in the file /etc/systemd/system/multi-user.target.wants/mariadb.service .

  4. Reload systemd :

    # systemctl daemon-reload
  5. Start mariadb :

    # systemctl start mariadb
Have more questions? Submit a request
Please sign in to leave a comment.