Monday 18 June 2018

command line - Turn off (spin down) external (USB) HDD on Linux


I have an external HDD connected through USB. There is that Gnome utility called "Disks". When working the disk is on the list on the left. If I click on "turn off" button, the disk disappear from the list and is no longer in lsusb output, and - most important - spins down, turning off.


What command(s) must I invoke from a script to turn off disk like that?


sudo hdparm -Y /dev/sdc

gives


/dev/sdc:
issuing sleep command
SG_IO: bad/missing sense data, sb[]: SOME HEX STUFF

Screenshot from Disks



Answer



Short lookup in gnome-disk-utility repo code, and:


udisksctl power-off -b /dev/sdX

In ArchLinux, /usr/bin/udisksctl is owned by udisks2 package.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...