Park / spin-down an external USB hard-disk, Linux

You umount your external USB hard-disk, next you pull the USB plug and you hear a little squeek sound, sseeeee. Yes, that is the head of the rotating drive hitting the disk. It's not good and over time it will damage your disk. Here are a few alternatives to avoid this by parking the disk head and then spinning the disk down. Note that this may not work on older Linux kernels and/or older disks . Some filemangers (e.g thunar) implement a eject button and it does unmount + spindown. You know that your filemanger does NOT spindown USB disks if you hear the "sseeeee" sound once you pull the USB cable. In that case just use the following commands from the commandline:

udisksctl

This command is part of the udisks package available from https://www.freedesktop.org/wiki/Software/udisks/ (ubuntu: apt-get install udisks2). You use it like this:
umount /dev/sdb1    # or whatever disk you had mounted
udisksctl power-off -b /dev/sdb

sg_start

This command is part of the sg3-utils package. It sends SCSI commands directly to the disk. It's available from http://sg.danny.cz/sg/
(ubuntu: apt-get install sg3-utils). You use it like this:
umount /dev/sdb1    # or whatever disk you had mounted
sg_start --stop /dev/sdb
The udisksctl command may not work on older linux distriutions but the sg_start will. I have manually installed the sg3-utils on a linux PC from 2009 and the "sg_start --stop" works fine.

© Guido Socher,