Filed under CLI | by Samuel Huckins | Date Posted: March 15, 2009 - 12:48 AM
Yet another awesome top clone for Linux, this time to make monitoring disk I/O simple: iostat. This post over at MDLog has a great introduction and explanation. For me it was available with apt-get, as iostat. Then you just run iostat. It produces a readable top-like display of what processes are currently performing the most disk I/O:

Here I have the display sorted on disk read activity, but any of the columns can be used as the sorting reference by pressing the left and right arrows. This tool could be quite useful in combination with mtop and other tools to see if, for instance, a MySQL instance is performing too much I/O, or if queries are still using memory efficiently.
Tags:
CLI,
disk,
I/O,
Linux
March 15, 2009 - 12:48 AM
Filed under CLI, Programming | by Samuel Huckins | Date Posted: January 10, 2009 - 12:18 AM
When a server is getting low on disk space, you need to find out what is taking up that space, and fast. I previously would run this command in /:
1
| sudo du -ch --max-depth=1 . |
This would show all the directories in / and their size. Then I would run it on the largest directory found by that command, and so on until I knew what was up. This is slow. And there is a better way! I created a script that looks for directories in your current directory (or in a directory you pass it). If there are directories in the directory, it looks to see how large they are. It then does the same process on the largest directory found, continuing until there are no more child directories. It also accepts an option to prompt you at each step whether or not you want to continue. This makes it much faster to zero in on the culprit.
Example output:
1 2 3 4 5 6 7
| sudo ./follow_largest_dirs.py -t /var
/var: 1033.21 MB (parent)
|-> lib: 499.9 MB
|--> defoma: 187.73 MB
|---> gs.d: 95.1 MB
|----> dirs: 94.94 MB
|-----> fonts: 94.94 MB |
With prompting:
1 2 3 4 5 6
| sudo ./follow_largest_dirs.py -t /var -p
/var: 1034.6 MB (parent)
|-> lib: 501.02 MB
Continue? (y/n) y
|--> defoma: 187.73 MB
Continue? (y/n) n |
Latest code can be found in my Trac. [EDIT, 2009-02-18: Added rounding of sizes and proper error checking in dir recursion based on suggestion by Dorantor. Thanks!] Current code:
Continue Reading “Tracking down used disk space: Follow largest directories”
Tags:
CLI,
disk,
disk space,
filesystem,
Python,
storage
January 10, 2009 - 12:18 AM