Linux - How to force unmount disk partition, Error - Device is busy

How to force unmount disk partition

When we are in a share network it happens that we wont be able to unmount the disk partition. The disk might be used by any of the users and it will prompt as the device is busy. However, Linux comes with fuser command to kill forcefully mounted partition.

Understanding the error device is busy
Linux is build in sucha a way that it does not allow to umount or umount the partition when any of the user is accessing the shared partition or if there ia s any open files. This happens to prevent the data loss.

Try the following command to find out what processes have activities on the device/partition. If your device name is /dev/sdb1, enter the following command as root user:
# lsof | grep '/dev/sdb1'

Output:
java  18075  jboss  416w   REG   253,5    85178   950282 /jbos/bin/my.log
The above output specifies that user jboss is executing a java process on /dev/sdb1, You can stop the java process and unmount/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.

To check the partiton or filesystem use
# lsof | grep '/jbos'

Use below command only if dont bother about DATA LOSS
Type the command to unmount /mnt forcefully:
# fuser -km /mnt
Where,
-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

If you would like to unmount a NFS mount point then try following command
# umount -f /mnt
Where,
-f: Force unmount in case of an unreachable NFS system

Linux umount command to unmount a disk partition, You can also try umount command with –l option
# umount -l /mnt
Where,
-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.

The topic on Linux - How to force unmount disk partition is posted by - Math

Hope you have enjoyed, Linux - How to force unmount disk partitionThanks for your time

Tech Bluff