Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 May 2013 02:10:51 +0200
From:      Polytropon <freebsd@edvax.de>
To:        "Ronald F. Guilmette" <rfg@tristatelogic.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Hot Swapping SATA drive?
Message-ID:  <20130515021051.6df78597.freebsd@edvax.de>
In-Reply-To: <9749.1368574451@server1.tristatelogic.com>
References:  <20130514144721.aa321c25.freebsd@edvax.de> <9749.1368574451@server1.tristatelogic.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 14 May 2013 16:34:11 -0700, Ronald F. Guilmette wrote:
> 
> In message <20130514144721.aa321c25.freebsd@edvax.de>, 
> Polytropon <freebsd@edvax.de> wrote:
> 
> >I've been using SCSI "hot swap" devices for many years, and
> >they usually required a re-scan of the bus. The same often
> >works for USB-connected devices which also use CAM, and maybe
> >SATA and eSATA also support it today?
> 
> OK, so what command should I use when I plug a drive in?  Would that be
> "camcontrol rescan foo" where "foo" is something like /dev/ada0?

No. You use the typical "SCSI-like device notation", bus:unit:lun,
for example 0:1:0, or "all" for all buses and devices.



> I'm
> guessing that that can't be correct, because ada0 is an actual drive.
> So what is the "device id" for the bus itself?

With "camcontrol devlist", you can get a list that will show
you what devices have been recognized and how the bus:unit:lun
corresponds to the device files.

Example:

$ camcontrol devlist
<HL-DT-ST DVDRAM GSA-H42N RL00>    at scbus0 target 0 lun 0 (pass0,cd0)
<HL-DT-ST DVD-ROM GDR8163B 0L30>   at scbus0 target 1 lun 0 (pass1,cd1)
<Generic Flash HS-CF 4.55>         at scbus3 target 0 lun 0 (pass2,da0)
<Generic Flash HS-MS/SD 4.55>      at scbus3 target 0 lun 1 (pass3,da1)
<Generic Flash HS-SM 4.55>         at scbus3 target 0 lun 2 (pass4,da2)
<WDC WD15 EARS-00MVWB0 >           at scbus4 target 0 lun 0 (pass5,da3)

The disk you're attaching will probably be something like the
entries for the USB disk (last line).



> >Again, it may be nice (to the system) to detach the ATA device
> >from the bus; see "man atacontrol" (and "man camcontrol" in
> >comparison) for the proper command to do this. From the "electrical
> >point of view", there should be no problem.
> 
> I am a firm believer in being nice.  I just need to know the proper
> command.   Would that be "camcontrol stop foo" ?

Yes. You can use the "start" and "stop" commands like the "attach"
and "detach" commands for atacontrol. Additionally, you can use
"tur" for "test (if) unit (is) ready", and "readcap" to print the
capabilities. Also "reset" and "rescan" are helpful.

See "man camcontrol" for details about what those commands do,
and how to properly call them. In most cases,

	# camcontrol <command> <bus:unit:lun | all>

will be the correct form.



> >The only thing that might be worth looking at in the CMOS setup
> >would be the "method" of the driver, making the device come up
> >as da0 (for example) or ada0, depending if EHCI or XHCI can be
> >selected.
> 
> Ummm... my new little SATA plug-in bay is strictly SATA... not eSATA,
> and *definitely* not USB, so I think that EHCI and/or XHCI are probably
> irrelevant.  Those are strictly USB things, no?

I'm not fully sure about that, but I assume you're right, if
the manufacturer has properly glued the SATA ports onto the
mainboard instead of creating some strange abomination of
a "SATA through USB something". :-)



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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130515021051.6df78597.freebsd>