I have a USB-powered external HDD connected to my DELL laptop. Some times, after clicking on "Safely remove" item in pop-up menu of its icon in side bar, the drive is un-mounted and is removed from /dev/
folder (sdb
and sdb1
both are removed) and lsusb
do not show the device, but the HDD remains spinning and I could sense the vibration by putting my finger on it. But some times a few second after clicking on "Safely remove", it stops spinning and has no vibration. Is there any way (may be a CLI command) to turn it off?
Try this:
on Linux Mint or Ubuntu
Running
hdparm -y /dev/sdb
as root will cause the disk to stop spinning. If anything access the disk, it will spin up again.The man page suggest this is only useful for IDE drives. However I have tested that it does work with a USB drive attached to a Dell running 14.04. The man page says the command will usually cause the drive to spin down, which suggests some drives exist which will not spin down when this command is issued.
Try the Disks utility - that should be on your menu somewhere (in my case under Accessories). You can also launch it from a terminal by running
... then select the disk and you will see a power button at top-right of the window, with tooltip "Power off the drive".
If your desktop does something fishy, you cal always fallback on the terminal.
On the other hand, once a device is unidentified as a block device on USB, then you can use sdparm or hdparm on that device to park the heads if so desired, however using such tools will not flash buffers. And if you forget that the device is sleeping and yank the power, then you can corrupt your data.
Unplug the USB cable should do it. If not, then plug it back in and safely remove it again until it stays off.
This is how I do that on Linux Mint 17.3
List your drives with partitions and make sure you select proper drive
Unmount all mounted partitions of the disk, for example with this command pattern
where X is your drive letter and Y a partition number you want to unmount.
Stop hdd
Unplug USB cable
I have three equally valid solutions from which you can take your pick.
My personal solution is to buy a use hub featuring a power switch for each port. I find it amazingly handy. If I recall, it cost only about $6 on amazon. I'll see if I can find you the item for sale before I post this, but it is enough to tell you such an affordable device exists. Found it!
In this other discussion it was determined that there is a terminal command which can be used to literally disable power from select usb ports. The question came up because the user who asked the question was using a battery operated tablet and his inconsiderate cow-orkers were plugging their cell phones in to charge, thus running down his battery. Check out the bloke who discovered the solution! ;-)
Finally, depending perhaps on the brand and features of said drive, there should be a "spin down" command you can send to the drive before unmounting it. I've never manually used such a command but back in the days of DOS, before energy saving features were common place, that was how you had to do it, so it stands to reason there's a way to do it today, and figuring it out may be as easy as writing to the drive manufacturer, looking at their website, or googling the correct question, ie "spin-down command for hard drives". I do not stand by the following solution. I did a casual search and found this. Your mileage may vary. Do let me know if it works for you.