File usage

KingLeo216

Member
Joined
Mar 14, 2024
Messages
55
Reaction score
9
Credits
514
Hi,

How to clean inode? Exclude the /tmp, /home and /boot.
Filesystem Inodes IUsed IFree IUse% Mounted on
devtmpfs 2026823 433 2026390 1% /dev
tmpfs 2029782 2 2029780 1% /dev/shm
tmpfs 2029782 868 2028914 1% /run
tmpfs 2029782 16 2029766 1% /sys/fs/cgroup
/dev/mapper/almalinux-root 13107200 13099972 7228 100% /
/dev/sda1 65536 343 65193 1% /boot
/dev/mapper/almalinux-home 47611904 1208238 46403666 3% /home
/dev/loop0 262144 135 262009 1% /tmp
tmpfs 2029782 1 2029781 1% /run/user/0

Thanks.
 


Do you really want to delete everything else?
Your system libraries and kernels?

There are quite a few other directories you need to exclude.
/bin /usr /lib /lib64 /etc /var and probably some others depending on which distro you are running.
 
Do you really want to delete everything else?
Your system libraries and kernels?

There are quite a few other directories you need to exclude.
/bin /usr /lib /lib64 /etc /var and probably some others depending on which distro you are running.
Yes, exclude also important file. Inode over 13Million and it took some time.

I need fast solution for this.
 
Yes, exclude also important file. Inode over 13Million and it took some time.

I need fast solution for this.

In that case, you could something like this.

Check Inode Usage:
Code:
df -i

Find and Remove Unnecessary Files:
Code:
find / -path /tmp -prune -o -path /home -prune -o -path /boot -prune -o -type f -size +100M -exec rm -f {} \;

Clear Cache and Temporary Files:
Code:
rm -rf /var/cache/*
Code:
rm -rf /var/tmp/*

Remove Old Log Files:
Code:
find /var/log -type f -name '*.log' -mtime +30 -exec rm -f {} \;

Find and Remove Empty Files and Directories:
Code:
find / -path /tmp -prune -o -path /home -prune -o -path /boot -prune -o -type f -empty -exec rm -f {} \;
Code:
find / -path /tmp -prune -o -path /home -prune -o -path /boot -prune -o -type d -empty -exec rmdir {} \;
 
Lucky i have found the issue. Seem session creating many file.

Solution: creating cron to do daily clean up
 


Follow Linux.org

Staff online

Members online


Top