我的系统连接了 USB、SD 卡和 SSD。我将所有设备USB(/dev/sdb1)、SSD(/dev/sda1)和sd卡(/dev/mmcblk1p1)安装在/mnt下。有没有办法卸载/mnt连接的所有设备?
\n(我可以通过对 lsblk/df/mount 输出执行 grep 并卸载单个输出来完成此操作,但我正在寻找另一种简单的解决方案或通过执行 3 次 umount /mnt)
\n这是 lsblk(多个安装点)的输出
\nlsblk\nNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT\nsda 8:0 0 232.9G 0 disk \n\xe2\x94\x94\xe2\x94\x80sda1 8:1 0 232.9G 0 part /mnt\nsdb 8:16 1 14.7G 0 disk \n\xe2\x94\x94\xe2\x94\x80sdb1 8:17 1 14.7G 0 part /mnt\nRun Code Online (Sandbox Code Playgroud)\n并在执行递归 umount 后
\nsudo umount --recursive /mnt\nlsblk\nNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT \nsda 8:0 0 232.9G 0 disk\n\xe2\x94\x94\xe2\x94\x80sda1 8:1 0 232.9G 0 part /mnt\nsdb 8:16 1 14.7G 0 disk\n\xe2\x94\x94\xe2\x94\x80sdb1 8:17 1 14.7G 0 part\nRun Code Online (Sandbox Code Playgroud)\n
-A, --all-targets
Unmount all mountpoints in the current namespace for the specified
filesystem. The filesystem can be specified by one of the mountpoints
or the device name (or UUID, etc.). When this option is used together
with --recursive, then all nested mounts within the filesystem are
recursively unmounted. This option is only supported on systems where
/etc/mtab is a symlink to /proc/mounts.
Run Code Online (Sandbox Code Playgroud)
这也许是你想要的吗?从man 8 umount。
| 归档时间: |
|
| 查看次数: |
12166 次 |
| 最近记录: |