I saw a strange issue once where the /staging filesystem is almost full, but I can't find where the space is being used.
'df -h' command shows that the filesystem is 100% used as below.
==>df -h
Filesystem size used avail capacity Mounted on
/staging 99G 99G 0K 100% /staging
But 'du -h' command says that only 3.7G out of 99G is used.
==> pwd
/staging
==> du -h | grep "\.$"
3.7G .
/staging
==> du -h | grep "\.$"
3.7G .
This is strange , now how will you find which files are consuming remaining 95.3G of disk space. The unix command which can be used here is 'lsof' - list of open files.
==> lsof | grep -i /staging
cat 4723 user1 txt VREG 270,28001 50028743680 15496 /staging
(/dev/vx/dsk/staging)
cat 4723 user1 3r VREG 270,28001 50028743680 15496 /staging
(/dev/vx/dsk/staging)
sed 4724 user1 1w VREG 270,28001 50028743680 15496 /staging
(/dev/vx/dsk/staging)
ksh 8796
jg8789 cwd VDIR
270,28001
1949696 11
/app/staging/pollers
ksh 10834
collect cwd VDIR
270,28001
1949696 11
/app/staging/pollers
cat 15794 user1
txt VREG 270,28001 52067398891 36877 /staging
(/dev/vx/dsk/staging)
cat 15794 user1 3r VREG 270,28001 52067398891 36877 /staging
(/dev/vx/dsk/staging)
sed 15795 user1 1w VREG 270,28001 50028743680 15496 /staging
(/dev/vx/dsk/staging)
All the highlighted entries sheds light on to the processes that are using huge disk space. Here we can see many 'cat', 'sed' commands are holding huge disk space which can be released by terminating the processes.
==> kill -9 4723 4724 15794 15795
DESCRIPTION ABOUT lsof
Lsof revision 4.82 lists on its standard output file infor-
mation about files opened by processes for the following
UNIX dialects:
AIX 5.3
Apple Darwin 9 (Mac OS X 10.5)
FreeBSD 4.9 for x86-based systems
FreeBSD 7.[012] and 8.0 for AMD64-based systems
Linux 2.1.72 and above for x86-based systems
Solaris 9 and 10
(See the DISTRIBUTION section of this manual page for infor-
mation on how to obtain the latest lsof revision.)
An open file may be a regular file, a directory, a block
special file, a character special file, an executing text
reference, a library, a stream or a network file (Internet
socket, NFS file or UNIX domain socket.) A specific file or
all the files in a file system may be selected by path.
Comments
Post a Comment