Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to spin down external hard drive from the terminal before unmounting.

It is an sata drive connected through usb.

Running hdparm gives this

 ry@G62x:/media$ hdparm -S10 937b2299-48ff-4a9c-8228-67ed4453e8fb/

 937b2299-48ff-4a9c-8228-67ed4453e8fb/:
 setting standby to 10 (50 seconds)
 HDIO_DRIVE_CMD(setidle) failed: Inappropriate ioctl for device
share|improve this question

6 Answers 6

up vote 9 down vote accepted

You can safely unmount and spin-down an external hard disk from the terminal most easily by using the command-line functionality of udisks, which does not require the use of sudo if your system is set up correctly. (To list your device names, enter mount in the terminal first.)

When you have found your external drive, use the following commands. You must first unmount the partition (use sdb1 or whatever mount showed as the location):

udisks --unmount /dev/sdb1

Then to safely remove (i.e. spindown- you will hear it click and spin-down), use only sdb, for example:

udisks --detach /dev/sdb

NOTE: It is of crucial importance here that you use sdb or sdc without a partition number when using the detach option; i.e. sdb1 or sdc1 will not work. The partition must be unmounted first and then the disk itself spun down as the examples show.

The udisks commands work successfully for all my pata and sata external hard disks.

share|improve this answer

Answer is based on a lot of assumptions, as i do not remember the source of it. But here it is:

  1. SATA is actually hot-pluggable, but must of controllers do not support it, while sada drives should.
  2. based on point above - if drive is unmounted it is save to unplug it. Base reason for that is point #3
  3. modern drives have enough power to remove drive heads from the platters in case of emergency power off that is detected.

at least this is what I do. And also, from time to time I do long SMART test on the disk, to see if health of drive is OK.

share|improve this answer

If it is 2.5" drive you should be able to hear your drive make click sound about 15 seconds after unmout. That is when drive parked reading/writing heads aside and you can safely remove it. If it is 3.5" drive then there is no way to make removing safer by spinning the drive down.

share|improve this answer
1  
It is a 3.5", I can umount it, then unplug it and still hear it spinning an hour or so later. –  winchendonsprings Aug 8 '11 at 18:35

For external USB disks, use

sg_start --stop /dev/sdb

Install using

sudo apt-get install sg3_utils

sg3_utilsInstall sg3_utils

Works for my WD My Book Essential Disks.

share|improve this answer

If you right-click the drive's icon and select Safely Remove Drive, that should do it (as already stated, it takes 15 seconds or so).

If you don't have that option, right-click and unmount the drive. Then start Disk Utility; select the drive in the left panel; select Safe Removal in the right panel. Again, wait 15 seconds or so. (Alternatively, you can Unmount Volume from Disk Utility before Safe Removal if that is easier for you.)

share|improve this answer

It worked in xfce4 on Fedora 17 for powering down external hard disk:

udisks --detach /dev/sdc

Palimpsest used to have power off option in Fedora 14, but not in Fedora 17.

Useful features go out with OS upgrade in both Windows and Linux.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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