Git Product home page Git Product logo

low_disk's People

Contributors

danielmadeira avatar lukeshirnia avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

ad01

low_disk's Issues

Add defaults info to help

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 inode breakdown option

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";

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.