已经有:
$ umount -l
。
但是,有没有一种方法可以静默卸载?
例如,这意味着:如果已卸载分区上的照片位于设备内部,则Linux最好将其保存在缓存中,文件管理器应仍显示文件和文件夹,并且在访问该缓存之前,缓存文件应可访问。其他的东西需要空间。
显然,您在中找不到任何方法man umount
。
只要通过device-mapper(/dev/mapper/
/ /dev/dm-*
)访问设备,就可以使用实现令人惊讶的重新映射dmsetup
。方便地,这包括
remove [-f|--force] device_name
Removes a device. It will no longer be visible to dmsetup.
Open devices cannot be removed except with older kernels that
contain a version of device-mapper prior to 4.8.0. In this case
the device will be deleted when its open_count drops to zero.
From version 4.8.0 onwards, if a device can't be removed because
an uninterruptible process is waiting for I/O to return from it,
adding --force will replace the table with one that fails all
I/O, which might allow the process to be killed.
我认为,如果可以在文件系统级别执行等效操作,则可能会得到更可靠的行为,但是这样做的选项似乎更加晦涩。例如,您需要某种构造,例如FUSE网络文件系统,sshfs ...作为网络文件系统,它必须支持读取缓存...,并且在手册页中看起来像缓存超时(例如,dirs)可以根据需要设置得很高。 .. sshfs支持重试,因此您应该能够终止SSH侦听器...在此示例中,缓存不满意的读取将无限期硬阻塞。
因此,我建议您花一些时间在设备映射器和上dmsetup
。
无论哪种情况,都不会卸载应用程序使用的文件系统。在其他位置,安装条目仍然可见/proc/mounts
。打开的文件必须指向某个文件系统。相反,您是从该文件系统的原始后备存储中分离该文件系统的。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句