Artificial intelligent assistant

How to unmount a formerly chroot'd filesystem? I'm using a rescue-live-system (similar to a live-cd) to fix some issues with my Debian server, like that: # mkdir -p /mnt/rescue # mount /dev/md2 /mnt/rescue # mount --bind /dev /mnt/rescue/dev/ # mount --bind /proc /mnt/rescue/proc/ # mount --bind /sys /mnt/rescue/sys/ Now I can chroot to `/mnt/rescue` \- but after I'm done, how to unmount the filesystem again? umount: /mnt/rescue: target is busy. (In some cases useful info about processes that use the device is found by lsof(8) or fuser(1)) I guess it's because `dev`, `proc` and `sys` are bound to the mounted file system. But it's not possible to unmount them either...

1. You have to first exit the chroot session, usually a simple `exit` will do:

exit


2. Then umount ALL binded directories:

umount /mnt/rescue/dev/
umount /mnt/rescue/proc/
umount /mnt/rescue/sys/


3. Then:

umount /mnt/rescue





* * *

In case you were worried that `sync` isn't used here, note that it has no influence on whether unmounting is possible. Unmounting flushes pending writes anyway (it has to, because there'd be nowhere for them to go after the unmounting). The presence of a chrooted process is irrelevant (except in that it prevents unmounting). In normal system operation, sync has no observable effect. sync only makes a difference if a device is physically disconnected without having been unmounted or if the system crashes while the device is mounted.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 932a484c7374cb422ac27366c825bc4a