using DF command
January 26, 2005 10:37 pmLink: ONLamp.com: Dealing with Full Disks.
The -h and -H flags both tell df to generate human-readable output. The small h uses base 2 to create a 1,024-byte megabyte, while the large H uses base 10 for a 1,000-byte megabyte. Most FreeBSD tools do not give you the option to use base 10; base 2 is undoubtedly more correct in the computer world, so we’ll use it for our examples.
We should also check the available inodes on a partition. Having lots of disk space is utterly moot if you run out of inodes and cannot create any more files! The -i option gives us that information.
So, the current disk usage is:
#df -hi
Filesystem Size Used Avail Capacity iused ifree %iused
Mounted on
/dev/ad0s1a 97M 43M 46M 48% 1368 23718 5% /
/dev/ad0s1f 4.9G 2.7G 1.8G 60% 184468 1117034 14% /usr
/dev/ad0s1e 194M 12M 166M 7% 794 49380 2% /var
procfs 4.0K 4.0K 0B 100% 41 1003 4% /proc
#
I don’t need to see the contents of each subdirectory. A total size of everything in the current directory would be nice. We can control the number of directories deep we display with du’s -d flag. -d takes one argument, the number of directories deep you want to show. A -0 will just give you a simple subtotal of the files in a directory.
#du -h -d0 $HOME
1.0G /home/mwlucas
#
I have a GB in my home directory? Let’s look a layer deeper and see where the heck it is.
#du -h -d 1
52M ./bin
1.4M ./.kde
24K ./pr
40K ./.ssh
2.0K ./.cvsup
812M ./mp3
1.0K ./.links
5.0K ./.moonshine
…
The big offender here is the mp3 directory
#cd /usr
#du -h -d1
…..
…..
Related posts:


