22
0
Fork 0

maj script inode + état stretch

This commit is contained in:
pdiogoantunes 2018-03-21 11:09:34 +01:00
parent d1ecad4ebd
commit 137c352dbf
1 changed files with 6 additions and 1 deletions

View File

@ -247,10 +247,15 @@ $ dd if=/dev/zero of=test count=10000000
### Lister les répertoires ayant le plus de fichiers <=> max inode
Sur Debian stretch, on peut utiliser la commande *ncdu*, et lors du listage, appuyer sur la touche c (*sort by items*).
~~~{.bash}
PATH_TO_WATCH='/var'; RESULT_FILE='list_max_inode.txt'; TMP=$(mktemp)
#Regarder dans le premier niveau
(for i in $(find $PATH_TO_WATCH -type d -printf '%p\n' | sed 's/"/\\"/g' | sed 's/^\(.*\)$/"\1"/'); do echo $(ls -a "$i" | wc -l) $i; done) | sort -n > $TMP
#OLD : find $PATH_TO_WATCH -type d -printf '%p\n' | sed 's/"/\\"/g' | sed 's/^\(.*\)$/"\1"/' | while read i; do echo $(echo $i | xargs ls -a | wc -l) $i; done | sort -n > $TMP
export IFS="
"; for i in $(find $PATH_TO_WATCH -type d); do echo $(ls -a | wc -l) $i; done | sort -n > $TMP
#compter dans les sous niveaux
cat $TMP | (while read line; do num=$(echo $line | awk '{ print $1 }'); path=$(echo $line | awk '{ print $2 }'); echo ${path%/*}; done) | sort | uniq | (while read line; do echo $(grep "$line" $TMP | cut -f1 -d' ' | xargs echo -n | tr -s ' ' '+' | xargs echo | bc -l) $line; done) | sort -n | tee $RESULT_FILE
rm $TMP