Php warning no space left on device

No space left on device but df still shows available space

A website running PHP suddenly returned a 500 internal server error. By analyzing the logs, the following entries appeared, as soon as the website was requested:

[error] [client 1.2.3.4] FastCGI: server «/usr/lib/cgi-bin/php5-fcgi» stderr: PHP message: PHP Warning: session_start(): open(/var/www/web/files/tmp/sess_2p27rr5idh5danjle3e237c4s4, O_RDWR) failed: No space left on device (28) in /var/www/web/updates/concrete5.6.3.1_updater/concrete/startup/session.php on line 34
[error] [client 1.2.3.4] FastCGI: server «/usr/lib/cgi-bin/php5-fcgi» stderr: PHP message: PHP Warning: Unknown: open(/var/www/web/files/tmp/sess_suh3bf1kj5tm77ftp8kkaqma26, O_RDWR) failed: No space left on device (28) in Unknown on line 0
[error] [client 1.2.3.4] FastCGI: server «/usr/lib/cgi-bin/php5-fcgi» stderr: PHP message: PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/www/web/files/tmp) in Unknown on line 0
[error] [client 1.2.3.4] FastCGI: server «/usr/lib/cgi-bin/php5-fcgi» stderr: PHP message: PHP Warning: session_start(): open(/var/www/web/files/tmp/sess_1q9pmqhmlh5p3cp41ohs2u6p44, O_RDWR) failed: No space left on device (28) in /var/www/web/updates/concrete5.6.3.1_updater/concrete/startup/session.php on line 34
[error] [client 1.2.3.4] FastCGI: server «/usr/lib/cgi-bin/php5-fcgi» stderr: PHP message: PHP Warning: Unknown: open(/var/www/web/files/tmp/sess_gjbe8a55db44htincmlpi7u986, O_RDWR) failed: No space left on device (28) in Unknown on line 0
[error] [client 1.2.3.4] FastCGI: server «/usr/lib/cgi-bin/php5-fcgi» stderr: PHP message: PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/www/web/files/tmp) in Unknown on line 0
Читайте также:  Все о html теория

The message cannot be mistaken: There is no space left on the device to write the session file.

Strangely enough, df -h showed a completely different story:

df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg0-var 60G 41G 16G 73% /

But by manually trying to create a file, the message was confirmed:

cd /var/www/web/files/tmp; touch bla
touch: cannot touch `bla’: No space left on device

And that’s when I remembered the inodes (OK, granted, after a couple of strange looks to the output):

df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/mapper/vg0-var 3932160 3932160 0 100% /

Yep. No inodes left on the device. Therefore no more files can be created, even though there would be still enough available space left.

Possible solutions:
1) Remove files
2) Increase file system

Add a comment

Comments (newest first)

Alexander from Schweiz wrote on Feb 24th, 2015:

But don’t assume, that IFree = 0 means, that there are no inodes free.

With btrfs, there are always «0» inodes free, but still you’re able to create files.

$ df -Ti .
Dateisystem Typ Inodes IBenutzt IFrei IUse% Eingehängt auf
/dev/mapper/Intern-Daten btrfs 0 0 0 — /data

$ ls -la
insgesamt 0
drwxrwxr-x 1 ask ask 0 Feb 24 17:42 .
drwxrwxr-x 1 ask ask 264 Feb 24 17:42 ..

$ ls -la
insgesamt 4
drwxrwxr-x 1 ask ask 16 Feb 24 17:42 .
drwxrwxr-x 1 ask ask 264 Feb 24 17:42 ..
-rw-rw-r— 1 ask ask 29 Feb 24 17:42 testfile

$ df -Ti .
Dateisystem Typ Inodes IBenutzt IFrei IUse% Eingehängt auf
/dev/mapper/Intern-Daten btrfs 0 0 0 — /data

Blog Tags:

© 2008 — 2023 by Claudio Kuenzler. Powered by .

This website uses own and third-party 🍪 cookies to improve your browsing experience. By continuing using our website you agree to the Cookie and Privacy Policy. I agree

Источник

php — write failed: No space left on device (28)

Your / is full and you are attempting to save to /opt/. which is on / too. You’ll have to find what is filling your / and free up some disk space.

You can find what’s using your disk space with something like this

cd / find . -maxdepth 1 -exec du -sh <> \; 

which will list the size of each top level directory. You can then drill down using the same find command.

Solution 2

/dev/mapper/VolGroup-lv_root 50G 47G 0 100% /

. session.save_path is correct (/opt/lampp/tmp/session) .

Ack. Your session save path is on / , which is full.

Solution 3

As an alternative to @Iain’s command, you can use du -m |awk ‘$1>5000’ to only list directories occupying more than 5GB, but not limited to the top level. Depending on how deep in the tree the culprit is, this might save you some typing (of cd xx && du . )

Can't rsync : write failed - No space left on device (28) (2 Solutions!!)

DevOps & SysAdmins: php - write failed: No space left on device (28) (3 Solutions!!)

How to solve Docker Error - No Space left on Device

FIX Kali Kernel update error (no space left on device)

What does write failed No space left on device mean - PHP

Bin Laiq

Updated on September 18, 2022

Comments

Warning: Unknown: write failed: No space left on device (28) in Unknown on line 0 Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/opt/lampp/tmp/session) in Unknown on line 0 
[[email protected] Documents]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup-lv_root 50G 47G 0 100% / tmpfs 504M 956K 503M 1% /dev/shm /dev/sda1 485M 68M 392M 15% /boot /dev/mapper/VolGroup-lv_home 96G 199M 91G 1% /home [[email protected] Documents]# df -i Filesystem Inodes IUsed IFree IUse% Mounted on /dev/mapper/VolGroup-lv_root 3276800 977907 2298893 30% / tmpfs 128858 5 128853 1% /dev/shm /dev/sda1 128016 52 127964 1% /boot /dev/mapper/VolGroup-lv_home 6332416 422 6331994 1% /home 

After executing «find . -maxdepth 1 -exec du -sh <> \;», the prompt blinks so long tome and does not stop.

Источник

Warning: session_write_close(): write failed: No space left

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

A_1

Active Member

in my cpanel i got that error when i want open phpmyadmin

Warning: session_write_close(): write failed: No space left on device (28) in /usr/local/cpanel/base/3rdparty/phpMyAdmin/index.php on line 44

Warning: session_write_close(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in /usr/local/cpanel/base/3rdparty/phpMyAdmin/index.php on line 44

mctDarren

Well-Known Member

You need to clean out your /tmp directory. Remove some old session vars from in there and you’ll be good.

A_1

Active Member

You need to clean out your /tmp directory. Remove some old session vars from in there and you’ll be good.

mctDarren

Well-Known Member

FeeL

Well-Known Member

phpmyadmin space problem?

Warning: session_write_close() [function.session-write-close]: write failed: No space left on device (28) in /usr/local/cpanel/base/3rdparty/phpMyAdmin/index.php on line 44

Warning: session_write_close() [function.session-write-close]: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in /usr/local/cpanel/base/3rdparty/phpMyAdmin/index.php on line 44

Warning: Cannot modify header information — headers already sent by (output started at /usr/local/cpanel/base/3rdparty/phpMyAdmin/index.php:44) in /usr/local/cpanel/base/3rdparty/phpMyAdmin/index.php on line 101

Swap Used 0.40 %
Disk /dev/hda3 (/) DMA+ 76 %
Disk /dev/hda1 (/boot) DMA+ 12 %

What should I do? Clean tmp??

AlexV.

Well-Known Member

What is the ouput from:
df -h /tmp

FeeL

Well-Known Member

Thanks for the quick (and smart) answer, Alex.

What is the ouput from:
df -h /tmp

You are right about the way to look at the space.

df -h /tmp
Filesystem Size Used Avail Use% Mounted on
/usr/tmpDSK 243M 242M 0 100% /tmp

My point now is..
Do I have to enlarge TMP space, or clean it up?
If cleaning, witch is the safest qay to do it?

FeeL

Well-Known Member

TMPWATCH=»/usr/sbin/tmpwatch»
PORTAGE_TMPDIR=»$(portageq envvar PORTAGE_TMPDIR)/portage»
DISTDIR=»$(portageq distdir)»

if [[ -d /tmp ]]; then
$ —atime 168 /tmp
fi

AndyReed

Well-Known Member

Filesystem Size Used Avail Use% Mounted on
/usr/tmpDSK 243M 242M 0 100% /tmp

It is likely that your /usr/tmpDSK is corrupted. You should stop all processes that have files open on /tmp such as MySQL and other applications using:

Delete all un-necessary files and then run the following command:

If that doesn’t help, contact us.

FeeL

Well-Known Member

Arjay

Registered

mctDarren

Well-Known Member

It depends on if your tmp is a virtually created directory or an actual partition set up for you. If the latter, contact your provider and see if they offer a service to run a partition manager for you at the machine. If it’s virtual you can use the technique from servertune above to trash the current tmp directory and create another.

If you want to increase your tmp dir size above normal, edit the /scripts/securetmp file and look for the line:

Increase the value here to as large as you would like tmp to be. Note, though, that you don’t want to make it _too_ large. A much better practice is to clean out tmp regularly using a script like tmpwatch to keep it to a controllable size. Here’s a script I use (in /scripts/cleantmp) that runs via cron every so often on our boxes to weed out useless and older tmp files:

# This script cleans out /tmp of empty, root, cpanel and nobody session files in /tmp # if --test is passed, we just show the results if [ "$1" == "--test" ] then CMD="-exec ls -la" echo "$0: test mode" else CMD="-exec rm -rf" fi # remove empty session files that are over 2 hours old find /tmp -name "sess*" -empty -mmin +120 -maxdepth 1 $CMD <> \; # remove root owned session files find /tmp -name "sess*" -user root -maxdepth 1 $CMD <> \; # remove nobody session files find /tmp -name "*sess*" -user nobody -maxdepth 1 $CMD <> \; # remove cpanel owned session files find /tmp -name "sess*" -user cpanel -maxdepth 1 $CMD <> \; # remove any session file over 4 hours old find /tmp -name "sess*" -mmin +240 -maxdepth 1 $CMD <> \; # remove any spamassassin file over 4 hours old find /tmp -name ".spamassassin*" -mmin +240 -maxdepth 1 $CMD <> \;

Run it with «—test» after and it will just show you all the files it would delete when running for real. This will give you an idea of what it’s cleaning out. The comments show you what line does what within the script. Hope this helps!

Источник

Оцените статью