Stop using a SATA drive

Polytropon freebsd at
Mon Aug 24 19:43:03 UTC 2015

On Mon, 24 Aug 2015 11:52:49 -0700, Chris Stankevitz wrote:
> How can I tell FreeBSD to stop using a SATA drive?  I'd like to pull
> it from my machine (while the machine is running) but I'd like to be
> confident that nothing is using it.
> I imagine I would feel confident that nothing is using it if the drive
> disappeared from /dev and it stopped spinning.  "camcontrol stop" did
> not accomplish this (that was a WAG -- camcontrol man page says that
> 'stop' only sends the 0x1B command whatever that means).
> Please let me know if you can imagine a better place for me to ask
> this question or learn more about the process.

Ye olde atacontrol had a "detach" option. Its equivalent
is "camcontrol stop" which you have discovered. This should
be sufficient. The disk will not be accessed by the system
anymore. In this state, it's safe to detach power and data
lines. Removing power will (what a surprise!) make the
drive stop spinning and also park the heads. Then it can
safely be moved mechanically.

St stopping the disk would probably only work for those
that have a SCSI command that _does_ this to the drive.
As far as I know, SATA drives don't have this ability.
The device node disappearing from /dev is achieved by
losening the data connection (which is the same as if
removing the power). Both things are probably hard to
achieve in hardware. I could imagine with a power supply
where you can - by software! - address the power lines,
or mainboards / controllers that allow you to address
the SATA ports and make them disappear...

However, I'm doing this with SATA and external USB disks
a lot: Issue "sync", call umount, give it some seconds
to actually complete (!) those tasks, and then power it
off (external power supply off for USB, combined plug
removed from SATA disk). No problems so far.

The features you're implicitely asking for do not
exist in x86 commodity hardware, as far as I know.
More expensive and non-consumer platforms usually
have those features. Look for midrange and mainframe
systems. :-)

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list