Showing posts with label Inodes. Show all posts
Showing posts with label Inodes. Show all posts

Thursday 27 December 2018

No space left on device in server | PHPMysql not connect session | Full Inodes 100% | Check CPU Process and MEMORY

Issues
  1. open(/var/lib/php/sessions/sess_, O_RDWR) failed: No space left on device (28)
  2. PHPMysql not connect
  3. Database not connect
Solusions

Check CPU and MEMORY usage of server from terminal
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu | head
df -h
Check file size
find /home/ -size +100M 

 

 Check INODES in server (Inode mean total files into server)
df -i
Search INODES from system and perticular folder (Get number of file in perticular directory)
for i in /var/www/html/*; do echo $i; find $i |wc -l; done
Check INODES into specific directory
ls -l /var/lib/php/sessions | wc -l
Remove all files from specific directory
rm -r /var/lib/php/sessions/ 
If you are using PHP so you can create code in any existing file
$path = '/var/lib/php/sessions/';
$dir = opendir($path);
$i = 0;
while ($dir && ($file = readdir($dir)) !== false) {
    unlink($path.$file);
    echo $i.' - '.$path.$file.'<br>';
    if($i == 50000){
        exit;
    }
    $i++;
}