Linux / UNIX will not allow you to unmount a device that is busy. There are many reasons for this (such as program accessing partition or open file) , but the most important one is to prevent data loss.
To find out the processes which are active on the partition.
[root@tempsrv ~]# lsof | grep "/mnt"
ssh 22883 lokams cwd DIR 253,1 4096 193537 /mnt
vi 22909 root cwd DIR 253,1 4096 193537 /mnt
/** or **/
[root@tempsrv ~]# fuser -mu /mnt
/mnt: 22883c(lokams) 22909c(root)
[root@tempsrv ~]#
Above output tells that users "lokams" and "root" has a "ssh and vi" processes running that is using /mnt. All you have to do is stop those process and run umount again. As soon as that program terminates its task, the device will no longer be busy and you can unmount it with the following command:
# umount /mnt
To unmount /mnt forcefully with out checking which processes are active currently:
# fuser -km /mnt
-k : Kill processes accessing the file.
-m : Name specifies a file on a mounted file system or a block device that is mounted. In above example you are using /mnt
You can also try umount command with –l option:
# umount -l /mnt
-l : Also known as Lazy unmount. Detach the filesystem from the filesystem hierarchy now, and cleanup all references to the filesystem as soon as it is not busy anymore. This option works with kernel version 2.4.11+ and above only.
To unmount a NFS mount point:
# umount -f /mnt
-f: Force unmount in case of an unreachable NFS system
The above can be accomplished with the below command in AIX:
# fuser -kxuc /mnt
The above can be accomplished with the below command in Solaris:
# fuser -ck /mnt
To list the process numbers and user login names of processes using the /etc/passwd file in AIX / Solaris, enter:
# fuser -cu /etc/passwd
No comments:
Post a Comment