udisksctl有power-off标志,建议您将其与
unmount
来自man udisksctl:
power-off
Arranges for the drive to be safely removed and powered off. On the
OS side this includes ensuring that no process is using the drive,
then requesting that in-flight buffers and caches are committed to
stable storage. The exact steps for powering off the drive depends
on the drive itself and the interconnect used. For drives connected
through USB, the effect is that the USB device will be deconfigured
followed by disabling the upstream hub port it is connected to
演示版
这是我卸载USB Jumpdrive,然后关闭电源
testdir:$ lsusb
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 009: ID 1