276/28 Tan Hoa Dong, Binh Tri Dong, Binh Tan, ho chi minh CITY
Communication services DPSCommunication services DPS

Processing Status Full Disk /tmp/ In CyberPanel

By default, OpenLiteSpeed use the directory /tmp/lshttpd/swap to store temporary files. If the partition /tmp of your small, the disk may be full, causing bugs entire VPS

Here's a summary of the steps move the folder Swapping of OpenLiteSpeed.

Create a new folder for Swapping Directory of OpenLiteSpeed:

Create a folder:

mkdir -p /lswstmp/lshttpd/swap


Set permissions:

chmod 750 /lswstmp/lshttpd

 

chmod 700 /lswstmp/lshttpd/swap


Assign ownership:

chown -R nobody:nobody /lswstmp/lshttpd


Access to the admin interface OpenLiteSpeed:

Address:

https://your-server-ip:7080/login.php


If not have an account, reset your password via the command:

/usr/local/lsws/admin/misc/admpass.sh


After login into the configuration server:

Server Configuration > General
In section Server Processchange the value of Swapping Directory

From the default value

/tmp/lshttpd/swap

to

/lswstmp/lshttpd/swap


Restart OpenLiteSpeed:

Use the web interface or SSH command:

 systemctl restart lsws


These steps can help you move the temp directory of OpenLiteSpeed to the partition are larger space, to avoid filling the disk of the partition /tmp small.


If you want to take advantage of RAM to create a drive for temporary (tmp), with higher speed, please perform the following steps:

Create a Folder for Ramdisk, Use the command:

sudo mkdir -p /mnt/ramdisk


Mount ramdisk with a storage capacity of 1GB:

sudo mount -t tmpfs -o size=1G tmpfs /mnt/ramdisk


This command creates a ramdisk temporary, with a capacity of 1GB.
Configuration For Ramdisk Automatically Mount at Startup:

Add the configuration to /etc/fstab to ramdisk are automatically mount every time the system boots.
Use the command:

echo 'tmpfs /mnt/ramdisk tmpfs nodev,nosuid,noexec,nodiratime,size=1G 0 0' | sudo tee -a /etc/fstab


This line will be added to the file /etc/fstab, allows the system to automatically create and mount the ramdisk with the option specified.

Choose:

Server Configuration > General
In section Server Processchange the value of Swapping Directory

From the default value

/tmp/lshttpd/swap

to

/mnt/ramdisk


Restart OpenLiteSpeed:

Use the web interface or SSH command:

 systemctl restart lsws

These steps will help you create a drive temporarily (temporary disk) on the RAM, which helps speed up data processing temporarily due to the high speed of the RAM compared to traditional hard disk.. This is especially useful for applications that require speed of processing data quickly, as the web service or application database. However, it should be noted that the data on the RAM will be lost when the system shuts down or reboots, so it should only be used for temporary files.


To add a cronjob to clean your hard disk for temporary to 3 am daily, you can perform the following steps:

Create a script file (logscleaner.sh) with contents:

nano logscleaner.sh

If using the disk, add the following line:

find /lswstmp/lshttpd/swap -type f -delete


If RAM usage add the following line:

find /mnt/ramdisk/ -type f -delete


Assign execute permissions to the script:

chmod +x logscleaner.sh


Try running the script to check:

sh logscleaner.sh


Add a cronjob in crontab:

crontab -e

 

0 3 * * * sh /root/logscleaner.sh


This Script will automatically run at 3 in the morning everyday to clean up the temporary files in the drive temporarily, to help minimize status full disk.

Previous Post Previous Post
Newer Post Newer Post
0 0 votes
Review article
Subscribe
Notify of
guest
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Anh
Anh
1 month ago

CHo mình hỏi, sau khi chuyển sang /lswstmp/lshttpd/swap thì mình xóa /tmp/lshttpd/swap không gây lỗi gì nhỉ?

en_GBEnglish