A HDD, which is older than 10 years, is getting read using a SATA-to-USB adapter.

When using sudo hdparm -y /dev/sdj, the HDD does not shut down.

But when using the Eject option in the File Manager, the HDD stops rotating.
Side fact: The eject option in Microsoft Windows does shut the HDD down as well.

Why does hdparm not make the HDD spin down while the File Manager does?


The hdparm command only does one thing, namely issuing a specific ATA command which tells the drive to transition to a standby state. This doesn't prevent anything from immediately waking up the drive with a new command however so depending on the drive itself, it may not even try to spin down (the smart ones wait a short period of time for incoming commands, and only spin down if there are none). Note that the hdparm man page does not guarantee that this will spin down the drive, it only says it will 'usually' do so.

In contrast, the Eject option in a file manager usually does a lot more than that. At minimum, it does the following (though not necessarily in this exact order):

  • It makes sure that there are no open files on the drive.
  • It forcibly flushes all filesystem buffers for all filesystems mounted from the drive.
  • It unmounts all mounted filesystems from the drive.
  • It flushes any block-layer caches for the device, and may tear down any intermediary block layers running on top of the device (for example, if FDE is being used, that will get shut down cleanly).
  • It flushes the device's write cache, if the device has a write cache enabled.
  • If the device can be put into a low or minimal power state programmatically, it does so.
  • If the device has physically removable media that can be ejected by software (for example, a CD drive), it issues the appropriate eject command. Otherwise, it may dissociate the block-level drivers for the device from the device itself, effectively shutting off communications with the device.

Those first five steps functionally ensure that nothing in userspace will issue any commands to the device that would wake it from the low power state triggerd in the sixth step, and the final step ensures that the device is properly removed from the system, and treated as a newly connected device the next time it is connected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.