TUTOS.EU

Démonter un point de montage sous Linux

La commande de base pour retirer un point de montage est umount

umount -f /le_point_de_montage
Lien vers le fichier : cliquez ici Copier le code

Cependant, si le point de montage est utilisé, vous aurez le message d'erreur device is busy

Sur https://forum.ubuntu-fr.org/viewtopic.php?id=61773 on apprend que l'on peut utiliser la commande fuser -kimuv $MOINT_POINT

avec

-k : kill processes accessing the named file
-i : ask before killing (ignored without -k)
-m : show all processes using the named filesystems
-u : display user IDs
-v : verbose output

 

Exemple

fuser -kimuv /point_montage_nfs
Lien vers le fichier : cliquez ici Copier le code

mais le résultat n'est pas garanti. Dans mon cas je savais que le point de montage était utilisé par motioneye, j'ai donc arrêter le service avec systemctl stop motioneye.service

suite à quoi la quoi la commande umount a fonctionné.

Votre point de montage peut aussi être monté au démarrage et déclaré dans fstab.
Vous pouvez donc annuler son montage en éditant fstab en faisant par exemple

nano /etc/fstab
Lien vers le fichier : cliquez ici Copier le code

Commentez la ligne à exclure en plaçant un # devant

 

http://oletange.blogspot.com/2012/04/umount-device-is-busy-why.html donne une liste d'autres possibilités :

Working directory or (possibly deleted) file open of a running process

					# umount /mnt/test
					umount: /mnt/test: device is busy.
					        (In some cases useful info about processes that use
					         the device is found by lsof(8) or fuser(1))
					# lsof /mnt/test/
					COMMAND   PID  USER   FD   TYPE DEVICE SIZE/OFF  NODE NAME
					bash    10934 tange  cwd    DIR    7,0     4096 65537 /mnt/test/testdir
					cat     14286 tange    1w   REG    7,0        0 65538 /mnt/test/testdir/a
					cat     14291 tange    1w   REG    7,0        2 65539 /mnt/test/testdir/b (deleted)
					# kill -9 10934 14286 14291
					# lsof /mnt/test/
					# umount /mnt/test

Open (possibly deleted) socket

					# umount /mnt/test
					umount: /mnt/test: device is busy.
					        (In some cases useful info about processes that use
					         the device is found by lsof(8) or fuser(1))
					# lsof -a | grep /mnt/test/
					tmux  14378  tange  6u  unix 0xacf703c0  0t0  656531 /mnt/test/tmux-1000/default type=STREAM
					# kill 14378
					# lsof -a | grep /mnt/test/ 
					# umount /mnt/test
					

nfs-kernel-server is exporting the directory (and the directory is mounted by a client)

					# umount /mnt/test
					umount: /mnt/test: device is busy.
					        (In some cases useful info about processes that use
					         the device is found by lsof(8) or fuser(1))
					# showmount -e
					Export list for alpha:
					/mnt/test 192.168.1.203
					# /etc/init.d/nfs-kernel-server stop
					# umount /mnt/test
					

A loopback device backing file exists in the dir

					# umount /mnt/test
					umount: /mnt/test: device is busy.
					        (In some cases useful info about processes that use
					         the device is found by lsof(8) or fuser(1))
					# losetup -a
					/dev/loop0: [0851]:6983 (/mnt/test/testdir/disk.img)
					/dev/loop1: [0851]:6986 (/mnt/test/testdir/disk2.img)
					# umount /mnt/test/testdir/disk.img
					# umount /mnt/test/testdir/disk2.img
					umount: /mnt/test/testdir/disk2.img: not mounted
					# losetup -d /dev/loop1
					# umount /mnt/test
					

A swapfile exists in the dir

					# umount /mnt/test
					umount: /mnt/test: device is busy.
					        (In some cases useful info about processes that use
					         the device is found by lsof(8) or fuser(1))
					# cat /proc/swaps
					Filename                                Type            Size    Used    Priority
					/mnt/test/testdir/swapfile              file            95480   0       -2
					# swapoff /mnt/test/testdir/swapfile
					# umount /mnt/test
					 

The device failed

					# umount /mnt/test
					umount: /mnt/test: device is busy.
					        (In some cases useful info about processes that use
					         the device is found by lsof(8) or fuser(1)) 
					# dmesg
					:
					[75620.618404] lost page write due to I/O error on md0
					[75620.618408] Buffer I/O error on device md0, logical block 16804
					:
					[75890.015507] INFO: task cp:27736 blocked for more than 120 seconds.
					[75890.015513] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
					[75890.015516] cp              D ffff88053fdd39c0     0 27736  27734 0x00000004
					## Here I have not found a solution, so:
					# umount -l /mnt/test
					 
					 

The dir contains an umounted encfs

					normaluser$ encfs /mnt/test/dir.enc /mnt/test/dir
					EncFS Password:
					# umount /mnt/test/dir
					# umount /mnt/test
					umount: /mnt/test: device is busy.
					        (In some cases useful info about processes that use
					         the device is found by lsof(8) or fuser(1))
					## Here I have not found a solution, so:
					# umount -l /mnt/test

 

 


Article(s) en relation(s)

2