Before unmounting a filesystem, Solaris checks to ensure that no files are open to prevent loss of data. The following are steps that can be followed when a filesystem won’t unmount.
The fuser utility lists processes using a file or files in a filesystem. It’s To determine what processes may be preventing a filesystem’s umount, the -c switch must be used as running this command as root:
fuser -c /mnt
/mnt: 19504tm 19492tm 19460tm
This command will list the process ids of processes with open files in the filesystem mounted under /mnt. The characters following the pid provide additional information about the file:
- c – the process is using the file as its current working directory
m – the file is mapped with mmap
o – the process is using it as an open file
r – the file is the root directory of the process
t – the process is accessing the file as a text file
y – this file is the controlling terminal for the process
A useful option for fuser is -u which adds the username owning the process to the display:
fuser -cu /mnt
/mnt: 19504tm(root) 19492tm(root) 19460tm(qmchenry)
If you feel comfortable killing the processes reported by fuser, you can do it in one quick blow with the -k option:
fuser -ck /mnt
This sends the SIGKILL signal to each process which is the same as running kill pid to each process.
However, before you go to this extreme, perhaps the most common reason a filesystem won’t unmount is because you (or a previous shell you used) has its current working directory in that filesystem.