Skip to main content
udisks bad reputation?
Source Link
Totor
  • 21.2k
  • 22
  • 85
  • 114

On Linux, eject will work, but will not really "finish the job" regarding USB rotating drives.

So first, you eject /dev/sdb (or umount everything).

And then, after proper unmounting, the best way to unplug a USB external hard-drive is:

 udisksctl power-off -b /dev/sdb 

or

 udisks --detach /dev/sdb 

This usually causes the drive to spin down gracefully.

Note: udisksctl might be a more "mainstream" tool, compared to udisks (the former is already installed on my Debian, the latter isn't & has been criticised for unnecessary spin up/down).

Some details

udisksctl

The documentation states (about the power-off option):

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.

Note that as some physical devices contain multiple drives (for example 4-in-1 flash card reader USB devices) powering off one drive may affect other drives. As such there are not a lot of guarantees associated with performing this action. Usually the effect is that the drive disappears as if it was unplugged.

udisks (deprecated?)

Precisely, the current implementation (as of 2014):

  • sends SCSI sync-cache command,
  • sends SCSI stop command,
  • unbinds the usb-storage kernel driver,
  • suspends the USB device (power),
  • logically disables/removes it from its USB port.

This process is close to the manual procedure that is suggested here. Initial answer was on askubuntu.

On Linux, eject will work, but will not really "finish the job" regarding USB rotating drives.

So first, you eject /dev/sdb (or umount everything).

And then, after proper unmounting, the best way to unplug a USB external hard-drive is:

 udisksctl power-off -b /dev/sdb 

or

 udisks --detach /dev/sdb 

This usually causes the drive to spin down gracefully.

Note: udisksctl might be a more "mainstream" tool, compared to udisks (the former is already installed on my Debian, the latter isn't).

Some details

udisksctl

The documentation states (about the power-off option):

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.

Note that as some physical devices contain multiple drives (for example 4-in-1 flash card reader USB devices) powering off one drive may affect other drives. As such there are not a lot of guarantees associated with performing this action. Usually the effect is that the drive disappears as if it was unplugged.

udisks

Precisely, the current implementation (as of 2014):

  • sends SCSI sync-cache command,
  • sends SCSI stop command,
  • unbinds the usb-storage kernel driver,
  • suspends the USB device (power),
  • logically disables/removes it from its USB port.

This process is close to the manual procedure that is suggested here. Initial answer was on askubuntu.

On Linux, eject will work, but will not really "finish the job" regarding USB rotating drives.

So first, you eject /dev/sdb (or umount everything).

And then, after proper unmounting, the best way to unplug a USB external hard-drive is:

 udisksctl power-off -b /dev/sdb 

or

 udisks --detach /dev/sdb 

This usually causes the drive to spin down gracefully.

Note: udisksctl might be a more "mainstream" tool, compared to udisks (the former is already installed on my Debian, the latter isn't & has been criticised for unnecessary spin up/down).

Some details

udisksctl

The documentation states (about the power-off option):

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.

Note that as some physical devices contain multiple drives (for example 4-in-1 flash card reader USB devices) powering off one drive may affect other drives. As such there are not a lot of guarantees associated with performing this action. Usually the effect is that the drive disappears as if it was unplugged.

udisks (deprecated?)

Precisely, the current implementation (as of 2014):

  • sends SCSI sync-cache command,
  • sends SCSI stop command,
  • unbinds the usb-storage kernel driver,
  • suspends the USB device (power),
  • logically disables/removes it from its USB port.

This process is close to the manual procedure that is suggested here. Initial answer was on askubuntu.

+ clarity (hopefully)
Source Link
Totor
  • 21.2k
  • 22
  • 85
  • 114

On Linux, eject will work, but will not really "finish the job" regarding USB rotating drives.

TheSo first, you eject /dev/sdb (or umount everything).

And then, after proper unmounting, the best way to unplug a USB external hard-drive, after proper unmounting/ejecting, is:

eject /dev/sdb  udisksctl power-off -b /dev/sdb 

or

eject /dev/sdb  udisks --detach /dev/sdb 

This usually causes the drive to spin down gracefully.

Note: udisksctl might be a more "mainstream" tool, compared to udisks (the former is already installed on my Debian, the latter isn't).

Some details

udisksctl

The documentation states (about the power-off option):

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.

Note that as some physical devices contain multiple drives (for example 4-in-1 flash card reader USB devices) powering off one drive may affect other drives. As such there are not a lot of guarantees associated with performing this action. Usually the effect is that the drive disappears as if it was unplugged.

udisks

Precisely, the current implementation (as of 2014):

  • sends SCSI sync-cache command,
  • sends SCSI stop command,
  • unbinds the usb-storage kernel driver,
  • suspends the USB device (power),
  • logically disables/removes it from its USB port.

This process is close to the manual procedure that is suggested here. Initial answer was on askubuntu.

On Linux, eject will work, but will not really "finish the job" regarding USB rotating drives.

The best way to unplug a USB external hard-drive, after proper unmounting/ejecting, is:

eject /dev/sdb udisksctl power-off -b /dev/sdb 

or

eject /dev/sdb udisks --detach /dev/sdb 

This usually causes the drive to spin down gracefully.

Note: udisksctl might be a more "mainstream" tool, compared to udisks (the former is already installed on my Debian, the latter isn't).

Some details

udisksctl

The documentation states (about the power-off option):

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.

Note that as some physical devices contain multiple drives (for example 4-in-1 flash card reader USB devices) powering off one drive may affect other drives. As such there are not a lot of guarantees associated with performing this action. Usually the effect is that the drive disappears as if it was unplugged.

udisks

Precisely, the current implementation (as of 2014):

  • sends SCSI sync-cache command,
  • sends SCSI stop command,
  • unbinds the usb-storage kernel driver,
  • suspends the USB device (power),
  • logically disables/removes it from its USB port.

This process is close to the manual procedure that is suggested here. Initial answer was on askubuntu.

On Linux, eject will work, but will not really "finish the job" regarding USB rotating drives.

So first, you eject /dev/sdb (or umount everything).

And then, after proper unmounting, the best way to unplug a USB external hard-drive is:

  udisksctl power-off -b /dev/sdb 

or

  udisks --detach /dev/sdb 

This usually causes the drive to spin down gracefully.

Note: udisksctl might be a more "mainstream" tool, compared to udisks (the former is already installed on my Debian, the latter isn't).

Some details

udisksctl

The documentation states (about the power-off option):

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.

Note that as some physical devices contain multiple drives (for example 4-in-1 flash card reader USB devices) powering off one drive may affect other drives. As such there are not a lot of guarantees associated with performing this action. Usually the effect is that the drive disappears as if it was unplugged.

udisks

Precisely, the current implementation (as of 2014):

  • sends SCSI sync-cache command,
  • sends SCSI stop command,
  • unbinds the usb-storage kernel driver,
  • suspends the USB device (power),
  • logically disables/removes it from its USB port.

This process is close to the manual procedure that is suggested here. Initial answer was on askubuntu.

+ clarity (hopefully)
Source Link
Totor
  • 21.2k
  • 22
  • 85
  • 114

On Linux, eject will work, but will not really "finish the job" regarding USB rotating drives.

The best way to unplug a USB external hard-drive, after proper unmounting/ejecting, is:

eject /dev/sdb udisksctl power-off -b /dev/sdb 

or

eject /dev/sdb udisks --detach /dev/sdb 

This usually causes the drive to spin down gracefully.

Note: udisksctl might be a more "mainstream" tool, compared to udisks (the former is already installed on my Debian, the latter isn't).

Some details

udisksctl

The documentation states (about the power-off option):

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.

Note that as some physical devices contain multiple drives (for example 4-in-1 flash card reader USB devices) powering off one drive may affect other drives. As such there are not a lot of guarantees associated with performing this action. Usually the effect is that the drive disappears as if it was unplugged.

udisks

Precisely, the current implementation (as of 2014):

  • sends SCSI sync-cache command,
  • sends SCSI stop command,
  • unbinds the usb-storage kernel driver,
  • suspends the USB device (power),
  • logically disables/removes it from its USB port.

This process is close to the manual procedure that is suggested here. Initial answer was on askubuntu.

On Linux, eject will work, but will not really "finish the job" regarding USB rotating drives.

The best way to unplug a USB external hard-drive, after proper unmounting, is:

udisksctl power-off -b /dev/sdb 

or

udisks --detach /dev/sdb 

This usually causes the drive to spin down gracefully.

Note: udisksctl might be a more "mainstream" tool, compared to udisks (the former is already installed on my Debian, the latter isn't).

Some details

udisksctl

The documentation states (about the power-off option):

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.

Note that as some physical devices contain multiple drives (for example 4-in-1 flash card reader USB devices) powering off one drive may affect other drives. As such there are not a lot of guarantees associated with performing this action. Usually the effect is that the drive disappears as if it was unplugged.

udisks

Precisely, the current implementation (as of 2014):

  • sends SCSI sync-cache command,
  • sends SCSI stop command,
  • unbinds the usb-storage kernel driver,
  • suspends the USB device (power),
  • logically disables/removes it from its USB port.

This process is close to the manual procedure that is suggested here. Initial answer was on askubuntu.

On Linux, eject will work, but will not really "finish the job" regarding USB rotating drives.

The best way to unplug a USB external hard-drive, after proper unmounting/ejecting, is:

eject /dev/sdb udisksctl power-off -b /dev/sdb 

or

eject /dev/sdb udisks --detach /dev/sdb 

This usually causes the drive to spin down gracefully.

Note: udisksctl might be a more "mainstream" tool, compared to udisks (the former is already installed on my Debian, the latter isn't).

Some details

udisksctl

The documentation states (about the power-off option):

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.

Note that as some physical devices contain multiple drives (for example 4-in-1 flash card reader USB devices) powering off one drive may affect other drives. As such there are not a lot of guarantees associated with performing this action. Usually the effect is that the drive disappears as if it was unplugged.

udisks

Precisely, the current implementation (as of 2014):

  • sends SCSI sync-cache command,
  • sends SCSI stop command,
  • unbinds the usb-storage kernel driver,
  • suspends the USB device (power),
  • logically disables/removes it from its USB port.

This process is close to the manual procedure that is suggested here. Initial answer was on askubuntu.

specifying OS
Source Link
Totor
  • 21.2k
  • 22
  • 85
  • 114
Loading
emphasis on udisksctl + details
Source Link
Totor
  • 21.2k
  • 22
  • 85
  • 114
Loading
replaced http://askubuntu.com/ with https://askubuntu.com/
Source Link
Loading
adding one equivalent command
Source Link
Totor
  • 21.2k
  • 22
  • 85
  • 114
Loading
mostly useful for rotating drives
Source Link
Totor
  • 21.2k
  • 22
  • 85
  • 114
Loading
Source Link
Totor
  • 21.2k
  • 22
  • 85
  • 114
Loading