One of my friend got a situation where in she is seeing 9 GB allocated to one of the filesystems which is
#df -k /mytest
Filesystem 1024-blocks Free %Used Iused %Iused Mounted on
/dev/mytestlv 9216 9216 100% 48804 12% /mytest
Filesystem 1024-blocks Free %Used Iused %Iused Mounted on
/dev/mytestlv 9216 9216 100% 48804 12% /mytest
She was wondering where does the other 5GB gone .
Reason:
This situation happens when a process is opening a file and dumping data into it and the file is removed while said process still has file open.So called process still holds that file space even file deleted.
How to Rectify ?
At first you need to check what are all the processes using a particular filesystem using "fuser" command.
# fuser -c /mytest
/mytest: 2567 4006c 6548c 8657
/mytest: 2567 4006c 6548c 8657
You need to kill the above process if you want to free up the space.
Note: You need to inform the respective application owner/support team and take the application down time if this file-system is used by any-application.
How to Kill the proceses ?
# fuser -kc /mytest
This will kill all the processes and space will be freed up.
Check the space now
#df -k /mytest
Filesystem 1024-blocks Free %Used Iused %Iused Mounted on
/dev/mytestlv 9216 4096 45% 48804 12% /mytest
Filesystem 1024-blocks Free %Used Iused %Iused Mounted on
/dev/mytestlv 9216 4096 45% 48804 12% /mytest
You may like the -u switch. It may not be available on all Linux distros.
ReplyDelete-u Append the user name of the process owner to each PID.
I like how to make presentations code in the blog
ReplyDeleteHow do you do it?