Applicable to:
- Plesk for Linux
Symptoms
- Plesk Obsidian running on a Linux-based operating system
- The server crashes due to lack of disk space
-
In the
/tmp
directory of the Linux server operating system, there are many subdirectories with names that are similar to the following:CONFIG_TEXT: /tmp/systemd-private-9301532e5ff749e388f365a25f51e9ea-mariadb.service-zvKlrX/tmp/
/tmp/systemd-private-9301532e5ff749e388f365a25f51e9ea-httpd.service-HRR15v/ -
Many system services have
PrivateTmp
set totrue
:# 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 -
The temporary subdirectories created in
/tmp
are using up all of the disk space and cause the server crash
Cause
The PrivateTmp systemd feature is enabled for the services mentioned in the subdirectory names of /tmp
. Configuring a systemd service with PrivateTmp=true
leads to the fact that the service starts using a private tmp
directory and creates subdirectories within the /tmp
server directory that store its temporary files. There are a lot of files in the created subdirectories and this causes lack of disk space.
Resolution
Solution 1
1. Log into your server via SSH
2. Configure the temporary file rotation to happen as often as you need it to by opening the file
/usr/lib/tmpfiles.d/tmp.conf
with your favorite command-line text editor.
3. When you open the file, you will see lines that are similar ot the following:
CONFIG_TEXT: #Clear tmp directories separately, to make them easier to override
#Type Path Mode User Group Age Argument
v /tmp 1777 root root 10d
v /var/tmp 1777 root root 30d
3. Save the changes
Note: The configuration file has a special syntax. Every line is a rule. Each line in the tmpfiles.d configuration file is separated by tabs or spaces into seven columns that define a rule. More information related to the possible configurations is available here.
Solution 2
Disable the PrivateTmp systemd feature for the service (example, for MariaDB):
-
Check which services have
PrivateTmp
set totrue
:# 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 -
Stop the service:
# systemctl stop mariadb
-
Change
PrivateTmp
value tofalse
in the file/etc/systemd/system/multi-user.target.wants/mariadb.service
-
Reload
systemd
:# systemctl daemon-reload
-
Start
mariadb
:# systemctl start mariadb
Comments
0 comments
Please sign in to leave a comment.