# Analysing disk space useage



## xy16644 (Jan 10, 2010)

I have noticed lately that the disk space on my server has been increasing quite a bit every month. Is there a FreeBSD utility that can tell me what directories are using the most disk space? Almost like showing me the top 10 (or whatever) folders that are using the most disk space.

I basically just want to know whats taking up the disk space in my system without having to go through all the directories manually.

Thanks for any help! :e


----------



## graudeejs (Jan 10, 2010)

man du(1)


----------



## xy16644 (Jan 10, 2010)

That was helpful, thank you!

I tried:

```
du -h -d 3 /usr/home/
```

as a start. Is there a way to display the biggest directories first? I couldn't find an option like this in the man file. Is there another way to do it?


----------



## graudeejs (Jan 10, 2010)

well something like this
`$  du -d 3 /usr/home/ | sort`

but I'm not sure it will be good enough, you can use grep to extract for examle M/G etc and then sort

`$  du -h -d 3 /usr/home/ | grep M | sort`
Still not perfect, but works for me sometimes


----------



## xy16644 (Jan 10, 2010)

I'm a bit confused. I ran the following command:

```
du -c -h -d 100 /
```

on every directory that was off the root and I roughly got about 4GB of space used in total. 

But if I log into Webmin it says I am using 9.57GB!

However, if I run the following command:

```
df -g

Filesystem                 1G-blocks Used Avail Capacity  Mounted on
/dev/mirror/RootMirror4s1a        69    4    59     6%    /
devfs                              0    0     0   100%    /dev
```

It confirms that I AM using only 4GB of space! Why is there the discrepency? Has it got to do with the swap space maybe?

PS: My swap file size is 3.4GB so adding that to 4GB gives me 7.4GB, still way under what Webmin reports!


----------



## phoenix (Jan 11, 2010)

Is webmin looking at the mirror device, or the two separate drives?  If it's looking at the individual drives, then obviously it will be doubled.


----------



## xy16644 (Jan 11, 2010)

Thats a good point phoenix!

Webmin is reporting space on the following device:

```
/dev/mirror/RootMirror4s1a
```

for root (/).

But if I type:

```
df -g
```
I get:

```
Filesystem                 1G-blocks Used Avail Capacity  Mounted on
/dev/mirror/RootMirror4s1a        69    3    59     6%    /
```

So I think Webmin is monitoring the mirrored device...I am confused now as they are both monitoring the same device but theres still a discrepency!


----------

