Aegdu - A Tool for Displaying Data Usage


File systems can have hundreds or even millions of files. Tracking how they are used can be very difficult, bordering on the impossible. Fortunately there is a tool, named agedu, that can give you a quick glimpse into the “age” of the data on a directory basis.

Install agedu on fedora 10

[root@server ~]# yum install agedu  
Loaded plugins: refresh-packagekit  
fedora                                                   | 2.8 kB     00:00  
updates                                                  | 3.4 kB     00:00  
Setting up Install Process  
Parsing package install arguments  
Resolving Dependencies  
--> Running transaction check  
---> Package agedu.i386 0:0-1.r8642.fc10 set to be updated  
--> Finished Dependency Resolution  
  
Dependencies Resolved  
Package Arch Version Repository Size
Installing agedu: i386 0-1.r8642.fc10 updates 43 k

Transaction Summary:
===================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 43 k
Is this ok [y/N]: y
Downloading Packages:
agedu-0-1.r8642.fc10.i386.rpm | 43 kB 00:04
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction

Installing : agedu 1/1

Installed:

agedu.i386 0:0-1.r8642.fc10

Complete!

To create an index of the directory tree you just run the command.

[root@server ~]# agedu -s /var

Built pathname index, 1010 entries, 65280 bytes of index
Faking directory atimes
Building index
Final index file size = 160136 bytes

📝#### Note, the "-s [directory]" produces an index file namedagedu.datin the current directory (Note: if the index file is in a directory being scanned,ageduwill ignore it).

[root@server ~]# ls -l /root  
total 536  
**-rw------- 1 root root 438548 2010-07-19 04:24 agedu.dat**  
-rw------- 1 root root   1274 2010-07-16 05:18 anaconda-ks.cfg  
drwxr-xr-x 2 root root   4096 2010-07-17 16:08 Desktop  
drwxr-xr-x 2 root root   4096 2010-07-16 05:26 Documents  
drwxr-xr-x 3 root root   4096 2010-07-16 06:04 Download  
-rw-r--r-- 1 root root  49933 2010-07-16 05:18 install.log  
-rw-r--r-- 1 root root   4639 2010-07-16 05:17 install.log.syslog  
drwxr-xr-x 2 root root   4096 2010-07-16 05:26 Music  
drwxr-xr-x 2 root root   4096 2010-07-16 05:26 Pictures  
drwxr-xr-x 2 root root   4096 2010-07-16 05:26 Public  
drwxr-xr-x 2 root root   4096 2010-07-16 05:26 Templates  
drwxr-xr-x 2 root root   4096 2010-07-16 05:26 Videos

Once the index is created you can query it. A great way to get started is to use the HTML display capabilities.

[root@server ~]# agedu -w Using Linux /proc/net magic authentication
URL: http://127.0.0.1:47523/

copy url and paste it on web browser

The web graphics display the age of the files in a specific directory, red being the oldest and green being the newest. The web page orders the directories by the total space used in the directory.

By default agedu looks for the oldest file when creating the scale as displayed in the web output. You can use the text option to query the index for the age of the data that doesn’t have to follow that scale. For example, one can scan for the amount of space in each directory that is older than 6 months by the following:

[root@server ~]# agedu -a 6m -t /var
132 /var/cache
12 /var/db
4 /var/empty
3772 /var/lib
4 /var/lock
28 /var/log
56 /var/run
24 /var/spool
1148 /var/www
8 /var/yp
5216 /var