Skip to content

ijstokes/duscan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Up to date documentation embedded in duscan accessible by:

    duscan -h

Uses Python os.stat to do a "du" like scan of a portion of the filesystem,
aggregating results at each level in the hierarchy.  These can be made
available in ".du" files in each directory, with details about the content in
that directory and also in all sub-directories.  Optionally HTML output
can be produced, and if the Python "pylab" module is available then pie charts
can be created as well (--img).  If you just want summary results for all
content this is also possible.

Filesystem scanning utility
---------------------------
duscan is designed to scan a filesystem to catalogue where the memory is
being used. In each directory it write a small .du file with that directory's
information. In the top directory, it also writes .du_file, .du_dir, .du_user,
and .du_group, which contain information about the whole directory tree.

Running duscan

The basic duscan command is python duscan It will run on python 2.4 through
2.6, but has not been tested on earlier or later versions. This will generate a
.du file in  every directory and .du_file/dir/user/group in the top directory. 

duscan takes the following options: abdDhiopPtuv

-a (--add) will scan the tree normally, but if a .du file is found that is less
    than a certain age, it will use the information from that file rather than
    scanning that subtree. It will attempt to read the .du_* files from  the
    same directory, but if it can't, the final .du_* files will be incomplete.

-b (--debug) run in debug mode. Prints out a ton of information, most of it not
    very useful

-d (--dir) set the top directory (where the scan will start from). Defaults to
    the current directory if not set.

-h (--help) print these docs and exit

-i (--img) generate .png pie graphs of the directories and put one file in each
    directory in the tree. Slows the program down a lot. If using this option,
    duscan should be run through sage or ipython, or another version of python
    that includes the pylab libraries

-o (--onlyvisible) only follow visible directories (i.e. not ones starting with
    a ".")

-p (--html-prefix) for use generating html. This is the prefix that will be
    built into the html links

-P (--fs-prefix) the part of the file system not to be included in links
    generated  by the html

-t (--html) generate html files (.du.html) with the duscan information.

-u (--use) use the image generated by -i in the html

-v (--verbose) run in verbose mode. Less information than debug mode, but prints
    a message when entering and exiting directories, as well as when writing a
    .du file and when reading an existing .du file (if running with -a)

duscan should be run as root, otherwise it will exit with an error message if
permission is denied to a directory.

EXCLUDE: list of the absolute paths to directories that you do not want scanned
(no trailing slash)

SUPPRESS: list of the absolute paths to directories you want scanned, but not
written to (no trailing slash)

Files:
******************
.du
Format:

TS FS DS TE FE DE SF SD TF TD
D1 S1
D2 S2
...

with the following meanings:
TS - Total Size of the directory (FS + DS) (MB)
FS - Total size of files in the directory (MB)
DS - Total size of the subdirectories (MB)
TE - Total number of entries in the directory
FE - Total number of file entries
DE - Total number of directory entries
SF - Total number of symlinked files
SD - Total number of symlinked directories
TF - Accumulated number of files (including all subdirs)
TD - Accumulated number of directories
D1/S1 - The largest subdirectory/its size (MB)
D2/S2 - Second largest subdirectory/its size (MB)
... - the rest of the directories sorted by size 
******************
.du_file/.du_dir
These files list all files greater than 10 MB and all directories larger than
100 MB (though these constants can easily be changed). 
Format:

SIZE1 ABSPATH1
SIZE2 ABSPATH2

listed in no particular order.
******************
.du_user/.du_group
These files list the total space used by each user/group on the system.

Format:
USERNAME/GROUPNAME SIZE

also in no particular order
******************

About

Scan a file system to collect disk usage stats

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages