Tanti Technology

My photo
Bangalore, karnataka, India
Multi-platform UNIX systems consultant and administrator in mutualized and virtualized environments I have 4.5+ years experience in AIX system Administration field. This site will be helpful for system administrator in their day to day activities.Your comments on posts are welcome.This blog is all about IBM AIX Unix flavour. This blog will be used by System admins who will be using AIX in their work life. It can also be used for those newbies who want to get certifications in AIX Administration. This blog will be updated frequently to help the system admins and other new learners. DISCLAIMER: Please note that blog owner takes no responsibility of any kind for any type of data loss or damage by trying any of the command/method mentioned in this blog. You may use the commands/method/scripts on your own responsibility. If you find something useful, a comment would be appreciated to let other viewers also know that the solution/method work(ed) for you.

Monday, 28 April 2014

AIX Basics: fuser


Removing files and unmounting file systems in unix should always be preceded by the ‘fuser’ command. Too many times I see situations where an application has a file or files opened and they are removed from the file system.  This causes even greater disparity between the ‘du’ and ‘df’ commands and confusion in general.
The filesystem will not release file space until the process in question has closed it.  ’df’ reflects this and ‘du’ does not.  The ‘-d’ option will aid in troubleshooting this situation:
# df -g
..
/dev/logicalv     72.00      0.00  100%    13579    96% /filesystem
..
# du -s /filesystem
32671176        /filesystem
# fuser -d /filesystem
/filesystem  123456
In this situation, process 123456 has a deleted file open from /filesystem.  Ideally, the admin would have done the following before deleting a file:
# fuser /filesystem/file
/filesystem/file: 123456
This shows that process 123456 is using the file.  Before deleting the file it needs to be released.
‘fuser’ can also be used to terminate all processes using a filesystem.  This should only be used when permission has been obtained to bring the application down.
# fuser -kxuc /filesystem/file
This will kill all processes using /filesystem/file.

No comments:

Post a Comment