Commit 32cfdab8 authored by Tomáš Szaniszlo's avatar Tomáš Szaniszlo Committed by Tomáš Szaniszlo
Browse files

umount: device is busy – namespaces

parent 26ecd724
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -310,3 +310,28 @@ With timestamp and new command output:
With fine-grained timestamp and command output diff:

    while :; do NEW="$(ls)"; if [ "$NEW" != "$OLD" ]; then date '+%F %T.%N'; diff -U0 <(echo "$OLD") <(echo "$NEW") | sed -n '4,$s/^/    /p'; fi; OLD=$NEW; done

- - -

### umount: device is busy – namespaces

    MOUNTPOINT=/var/tmp

Where is it used?

    for PID in $(lsns -t mnt -o pid -n); do
        ps -o pid,pcpu,pmem,tname,stat,start,bsdtime,unit,args $PID
        grep $MOUNTPOINT /proc/$PID/mounts
        echo ---
    done

Unmount it in the given namespace:

    nsenter -m -t $PID umount $MOUNTPOINT
    umount -N $PID $MOUNTPOINT

Just unmount it everywhere:

    for PID in $(lsns -n -l -t mnt -o pid); do ps u $PID; umount -N $PID $MOUNTPOINT; done

Or restart the service (units) using the mountpoint in the given namespace.