Pages

Thursday, February 10, 2011

Determine Which Directory is Hogging the most Disk Space

  1.  cd into the mount point directory for the given file system 
  2.  Determine space usage for the subdirectories within the mount point directory: 
    •  du -sm * | sort -nr | head 
      •  if the mount point directory contains subdirectories named as dot files, the "*" pattern won't include them 
      •  if there are many subdirectories, you may want to increase the amount of output produced (eg, perhaps "head -20" instead of the default 10 lines) 
  3.  Examine the output from step (2), and look for directories with disproportionately large sizes. For each one, enter the directory and repeat from step (2) until the source of the problem becomes obvious. 
    • ls -lst --block-size=1M lists files in the directory in: 
                Where:
      • -l long format 
      •  -s with size blocks of Megabits(--block-size=1M) (-S to sort by size) 
      • -t sorts files according to modification time (newest first) 
    See  Using Find to Delete Files  for tricks on how to delete multiple files at once

    No comments: