lukeshirnia / low_disk Goto Github PK
View Code? Open in Web Editor NEWGather disk usage information for specific filesystems on a Linux machine
License: GNU General Public License v3.0
Gather disk usage information for specific filesystems on a Linux machine
License: GNU General Public License v3.0
Following styles from other --help
outputs, add the default option for --filesysten
and maybe specify the default output type (and that --inode
changes the report type?)
Add a --inode
option for a breakdown of the systems inodes.
Dissect and implement the following:
intNumFiles=20;
intDepth=5;
strFsMount=$(df -P $PWD | awk '$1 !~ /Filesystem/ {print $6}');
resize > /dev/null;
echo -e "############## BEGIN REPORT\n\n\n[b]== Server Time at start: ==[/b]";intStartTime=$(date +%s);
date;
echo -e "\n[b]== Inode Information for [ $strFsMount ]: ==[/b]";
df -PTi $strFsMount | column -t;
strFsDev=$(df -P $PWD | awk '$0 !~ /Filesystem/ {print $1}');
echo -e "\n[b]Storage device behind filesystem [ $strFsMount ]:[/b]";
echo $strFsDev;
echo -e "\n[b]== Top inode Consumers on [ $strFsMount ]: ==[/b]";
awk '{ printf "%11s \t %-30s\n", $1, $2 }' <(echo "inode-Count Path");
awk '{ printf "%11'"'"'d \t %-30s\n", $1, $2 } ' <(
strMounts="$(findmnt -o TARGET -rn | sed 's/^\s*/\^/g' | sed 's/$/\$|/g' | tr -d '\n' | sed 's/|$/\n/')";
find $strFsMount -maxdepth $intDepth -xdev -type d -print0 2>/dev/null | while IFS= read -rd '' i;
do if ! echo $i | grep -E "$strMounts";
then echo "$(find "$i" -xdev | wc -l ) $i ";
fi;
done | sort -n -r | head -n $intNumFiles
) ;
echo -e "\n[b]== Bytes per Inode format for [ $strFsMount ]: ==[/b]";
echo "$(printf "%.1f\n" $(echo "$(tune2fs -l $strFsDev | awk -F ": *" '$1 ~ /Inode count/ { inodecount = $2 }; $1 == "Block count" {printf "%s", $2}; $1 == "Block size" {printf "%s", " * " $2 " / " inodecount };' | tr -d '\n') /1024" | bc)) KB per inode"'!';
echo -e "\n[b]== Disk [i]space[/i] [ $strFsMount ]: ==[/b]";
df -hTP $strFsMount;
intEndTime=$(date +%s);
intDuration=$((intEndTime-intStartTime));
echo -e "\n[b]== Elapsed Time: ==[/b]";
printf '%dh:%dm:%ds\n' $(($intDuration/3600)) $(($intDuration%3600/60)) $(($intDuration%60));
echo -e "\n[b]== Server Time at completion: ==[/b]";
date;
echo -e "############## END REPORT\n\n\n";
Hi there. Please add long-form versions of the args. eg. --filesystem
, --bbcode
, --help
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.