XU4 swapfile

Hi Fourdee,

A few times recently I get the 100% use swapfile warning message on the Cloudshell screen. I have 100 MB allocated. This persists until I reboot.

Is this anything to be concerned about? I assume so or else it wouldn’t give a warning message?

Sometimes but maybe not every time this has happened has been when copying large files into ownCloud.


Hi John,

The temp upload directory is


(disk). As for why its possibly using up memory, not sure.

Can you please give results for:

df -h
cat /etc/sysctl.conf | grep swap
cat /etc/php5/apache2/php.ini | grep upload_tmp_dir
cat /etc/php5/cli/php.ini | grep upload_tmp_dir
cat /etc/php5/fpm/php.ini | grep upload_tmp_dir
cat /etc/php5/cgi/php.ini | grep upload_tmp_dir

In the mean time, try increasing the swapfile size:

#advanced options
#swapfile size
#try 1000

Hi Fourdee,

root@Odroid:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       110G   27G   78G  26% /
udev             10M     0   10M   0% /dev
tmpfs           399M  6.9M  392M   2% /run
tmpfs           996M     0  996M   0% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           996M     0  996M   0% /sys/fs/cgroup
tmpfs            10M  1.3M  8.8M  13% /DietPi
tmpfs           996M   16K  996M   1% /tmp
/dev/mmcblk0p1   71M   25M   47M  35% /boot
/dev/sdb1        15G  4.9G  9.1G  35% /mnt/usb_1
tmpfs           200M     0  200M   0% /run/user/0

root@Odroid:~# cat /etc/sysctl.conf | grep swap

root@Odroid:~# cat /etc/php5/apache2/php.ini | grep upload_tmp_dir
cat: /etc/php5/apache2/php.ini: No such file or directory

root@Odroid:~# cat /etc/php5/cli/php.ini | grep upload_tmp_dir
upload_tmp_dir = /var/tmp/php_upload_tmp

root@Odroid:~# cat /etc/php5/fpm/php.ini | grep upload_tmp_dir
upload_tmp_dir = /var/tmp/php_upload_tmp

root@Odroid:~# cat /etc/php5/cgi/php.ini | grep upload_tmp_dir
;upload_tmp_dir =

I’ve installed php7 if that may be relevant?


Edit /etc/apt/sources.list and when apt-get install php7.* ?

Hmm, sorry, bad idea …

As far as I know, php7.0 is still in beta and where is no application who need it coercively.

All dietpi-software, who need php, is optimise for php5 so far.

Yes it is a bit cutting edge but I’d done it earlier on BPi and was so impressed with the performance boost I tried it on the XU4 and found the same. Do you think this could be behind the swapfile problem?


If i remember correctly, PHP uses the /tmp folder for uploads by default. As this is mounted to RAM in DietPi, may be the cause of out of memory.

We change the upload directory for PHP5, to a disk location during installation:

cat /etc/php5/cli/php.ini | grep upload_tmp_dir
upload_tmp_dir = /var/tmp/php_upload_tmp

. Maybe PHP7 has a new or different option? Could even be a new config file location (eg: /etc/php7/cli/php.ini) , although, i’am not sure myself, haven’t tried PHP7 yet.

Hi Fourdee,

php7.0 uses the system default location for tmp files - I’ve changed the temp upload directory to the one you suggest - so will see if the the swapfile problem goes away.


Hi John,

Excellent. Fingers crossed :slight_smile:

All good now swapfile use has at most been 3%.

Thanks again for your help.


Hi John,

Excellent, good to hear all is well. Thanks for letting me know :slight_smile:

I’ll be taking a look at PHP7 when I start work on Debian Stretch, but wont be for a while, at least until we get more requests for it: https://github.com/Fourdee/DietPi/issues/475

Basically Stretch is the next Debian release, newer software versions (eg: PHP7) but its still in “testing”, so could be buggy: DebianStretch - Debian Wiki