From owner-freebsd-questions@freebsd.org Thu Aug 27 11:45:53 2015 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B680D9C3E0D for ; Thu, 27 Aug 2015 11:45:53 +0000 (UTC) (envelope-from quartz@sneakertech.com) Received: from douhisi.pair.com (douhisi.pair.com [209.68.5.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 981BDBD8 for ; Thu, 27 Aug 2015 11:45:52 +0000 (UTC) (envelope-from quartz@sneakertech.com) Received: from [10.2.2.1] (pool-173-48-121-235.bstnma.fios.verizon.net [173.48.121.235]) by douhisi.pair.com (Postfix) with ESMTPSA id 1FC093F6ED for ; Thu, 27 Aug 2015 07:45:46 -0400 (EDT) Message-ID: <55DEF869.1010202@sneakertech.com> Date: Thu, 27 Aug 2015 07:45:45 -0400 From: Quartz MIME-Version: 1.0 To: freebsd-questions@freebsd.org Subject: Re: Stop using a SATA drive References: <20150824214252.53aa04c6.freebsd@edvax.de> In-Reply-To: <20150824214252.53aa04c6.freebsd@edvax.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2015 11:45:53 -0000 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. :-) > >