Friday, April 23, 2021

How to identify which folder is taking more space in ubuntu or If the Inodes reached to 100% need to remove temp session files from /var/lib/php/sessions/*

Info1: 

Goto location of the root folder and run this below command.

du -shx *

Output: 

563M folder1

5.8M folder2 

 *********************************************************************************

Info2: 

df -h This command is used to display total and remaining disk space

Filesystem      Size  Used Avail Use% Mounted on

udev            487M     0  487M   0% /dev

tmpfs           100M   12M   88M  12% /run

/dev/xvda1       20G   12G  7.3G  62% /

tmpfs           496M     0  496M   0% /dev/shm

tmpfs           5.0M     0  5.0M   0% /run/lock

tmpfs           496M     0  496M   0% /sys/fs/cgroup

tmpfs           100M     0  100M   0% /run/user/0

***********************************************************************************Info3:

 df -i This command is used to display total files and it will indicate Inodes usages

Filesystem      Inodes   IUsed  IFree IUse% Mounted on
udev            124467     360 124107    1% /dev
tmpfs           126788     533 126255    1% /run
/dev/xvda1     1310720 1134443 176277   87% /
tmpfs           126788       1 126787    1% /dev/shm
tmpfs           126788       7 126781    1% /run/lock
tmpfs           126788      16 126772    1% /sys/fs/cgroup
tmpfs           126794       4 126790    1% /run/user/0

Info4:

Below command is used for find out which file is taking more than 100MB

sudo find / -type f -size +100M -exec ls -lh {} \;

Info5:

General useful info

sudo apt autoremove

sudo apt-get clean

sudo find / -type f -printf '%12s %p\n' 2>/dev/null|awk '{if($1>999999999)print $0;}'

Info6:

We need to remove files from this folder

root@ip-000-00-00-00:/var/lib/php# rm sessions/*