Stop using a SATA drive
quartz at sneakertech.com
Thu Aug 27 11:45:53 UTC 2015
I have a related question to this.
On OSX, you can access the Disk Utility app from the terminal via the
'diskutil' command. This provides a more or less one-stop-shop for all
disk related activities, eg; you can issue 'diskutil list' to get a list
of all known disk devices and their ID and partitions, you can 'diskutil
unmount foo' to stop all writes on disk foo, and then 'diskutil eject
foo' to completely disconnect it from the system so it no longer shows
up in /dev (using dd to read or write to the drive will fail with "No
such file or directory").
I believe Chris was looking for an equivalent command (or equivalent to
'diskutil eject foo' at any rate). OSX was based on FreeBSD originally,
so the underlying concept should be possible. Is there no port or
package that can provide this functionality?
On Aug 24 3:42 PM, Polytropon wrote:
> 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. :-)
More information about the freebsd-questions