xref: /netbsd-src/sbin/atactl/atactl.8 (revision 413d532bcc3f62d122e56d92e13ac64825a40baf)
1.\"	$NetBSD: atactl.8,v 1.24 2013/01/09 21:58:23 riastradh Exp $
2.\"
3.\" Copyright (c) 1998 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Ken Hornstein.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28.\" POSSIBILITY OF SUCH DAMAGE.
29.\"
30.Dd January 9, 2013
31.Dt ATACTL 8
32.Os
33.Sh NAME
34.Nm atactl
35.Nd a program to manipulate ATA (IDE) devices and busses
36.Sh SYNOPSIS
37.Nm
38.Ar device
39.Ar command
40.Oo
41.Ar arg Oo ...
42.Oc
43.Oc
44.Sh DESCRIPTION
45.Nm
46allows a user or system administrator to issue commands to and otherwise
47control devices which reside on standard IDE and ATA controllers, or
48the ATA bus itself.
49It is used by specifying a device or bus to manipulate,
50the command to perform, and any arguments the command may require.
51.Sh DEVICE COMMANDS
52The following commands may be used on IDE and ATA devices.
53Note that not all devices support all commands.
54.Bl -tag -width setidleXX
55.It Cm identify
56Identify the specified device, displaying the device's vendor, product,
57revision strings, and the device's capabilities.
58.It Cm idle
59Place the specified device into Idle mode.
60This mode may consume less power than Active mode.
61.It Cm standby
62Place the specified device into Standby mode.
63This mode will consume less power than Idle mode.
64.It Cm sleep
65Place the specified device into Sleep mode.
66This mode will consume less power than Standby mode,
67but requires a device reset to resume operation.
68Typically the
69.Xr wd 4
70driver performs this reset automatically,
71but this should still be used with caution.
72.It Cm setidle Ar idle-timer
73Places the specified device into Idle mode,
74and sets the Idle timer to
75.Ar idle-timer
76seconds.
77A value of 0 will disable the Idle timer.
78.It Cm setstandby Ar standby-timer
79Places the specified device into Standby mode,
80and sets the Standby timer to
81.Ar standby-timer
82seconds.
83A value of 0 will disable the Standby timer.
84.It Cm checkpower
85Will print out if the device is in Active, Idle, or Standby power
86management mode.
87.It Cm apm Bq Ar disable | set #
88Controls the Advanced Power Management feature of the specified device.
89Advanced Power Management is an optional feature used to specify a power
90management level to balance between device performance and power consumption.
91.Bl -tag -width selftestXlogXX
92.It Ar disable
93Disable the Advanced Power Management.
94.It Ar set #
95Enable the Advanced Power Management feature and set its level to the value #,
96where # is an integer within the scale 0-253; being 0 the mode with the
97lowest power consumption (and thus the worse performance) and 253 the mode
98which provides the better performance at a cost of more power consumption.
99.Pp
100It should be noted that the effect of the value need not be continous.
101For example, a device might provide only two modes: one from 0 to 126
102and other from 127 to 253.
103Per the specification, values of 127 and higher do not permit the device
104to spin down to save power.
105.El
106.It Cm smart Bq Ar enable | disable | status | offline # | error-log | selftest-log
107Controls SMART feature set of the specified device.
108SMART stands for Self-Monitoring, Analysis, and Reporting Technology.
109It provides an early warning system by comparing subtle operation
110characteristics to those determined in vendor testing
111to precede device failures.
112.Bl -tag -width selftestXlogXX
113.It Ar enable
114Enables access to SMART capabilities within the device.
115Prior to being enabled, a SMART capable device neither
116monitors nor saves SMART attribute values.
117The state of SMART, either enabled or disabled, will
118be preserved by the device across power cycles.
119.It Ar disable
120Disables access to SMART capabilities within the device.
121Attribute values will be saved, and will no longer be monitored.
122.It Ar status
123Reports whether SMART is supported by the device, and whether SMART is
124enabled on the device (can only be determined on ATA6 or better devices).
125If SMART is enabled, then a table of attribute information is printed.
126Attributes are the specific performance or calibration parameters that
127are used in analyzing the status of the device.
128The specific set of attributes being used and the identity of
129these attributes is vendor specific and proprietary.
130.Pp
131Attribute values are used to represent the relative reliability of
132individual performance or calibration parameters.
133The valid range of attribute values is from 1 to 253 decimal.
134Lower values indicate that the analysis algorithms being used by the device
135are predicting a higher probability of a degrading or faulty condition.
136.Pp
137Each attribute value has a corresponding threshold limit which is used for
138direct comparison to the attribute value to indicate the existence of a
139degrading or faulty condition.
140The numerical value of the attribute thresholds are determined by the
141device manufacturer through design and reliability testing and analysis.
142Each attribute threshold represents the lowest limit to which its
143corresponding attribute value can equal while still retaining a
144positive reliability status.
145.Pp
146If the crit field is
147.Dq yes
148then negative reliability of this attribute
149predicts imminent data loss.
150Otherwise it merely indicates that the intended design life period
151of usage or age has been exceeded.
152The collect field indicates whether this attribute is updated while the
153device is online.
154The reliability field indicates whether the attribute
155value is within the acceptable threshold.
156.It Ar offline #
157Runs the numbered offline self-test on the drive.
158.It Ar error-log
159Prints the error log.
160.It Ar selftest-log
161Prints the self-test log.
162.El
163.It Cm security Bq Ar status | freeze | setpass | unlock | disable | erase
164Controls
165.Dq security
166(password protection) features of modern ATA drives.
167The security commands are intended to be issued by low-level
168software (firmware / BIOS) only.
169Generally, the security status should be
170.Dq frozen
171before the operating system is started so that misbehaving or malicious
172software cannot set or change a password.
173Older and buggy BIOSes neglect to do so; in these cases it might make
174sense to issue the
175.Dq freeze
176command early in the boot process.
177.Bl -tag -width freezeXX
178.It Ar status
179displays the drive's security status
180.It Ar freeze
181freezes the drive's security status
182.It Ar setpass Bq user | master
183sets the drive's user or master password
184.It Ar unlock Bq user | master
185unlocks a password-protected drive
186.It Ar disable Bq user | master
187disables password protection
188.It Ar erase Bq user | master
189erases the device and clears security state, using enhanced erasure if
190the drive supports it; may take a long time to run
191.El
192.Pp
193Note that to erase a drive, it must have a password set and be
194unfrozen.
195If you can't persuade your firmware to leave the drive unfrozen on
196boot, but it is a SATA drive, say
197.Pa wd2
198at
199.Pa atabus3 ,
200that you can safely physically disconnect and reconnect, then you may
201be able to use SATA hot-plug to work around this: first run
202.Bd -literal -offset indent
203# drvctl -d wd2
204.Ed
205.Pp
206Then physically disconnect and reconnect the drive, and run
207.Bd -literal -offset indent
208# drvctl -r -a ata_hl atabus3
209.Ed
210.Pp
211After this, check that the security status does not list
212.Dq frozen :
213.Bd -literal -offset indent
214# atactl wd2 security status
215	supported
216#
217.Ed
218.El
219.Sh BUS COMMANDS
220The following commands may be used on IDE and ATA busses.
221Note that not all devices support all commands.
222.Bl -tag -width resetXX
223.It Cm reset
224Reset the bus.
225This will reset all ATA devices present on the bus.
226Any ATAPI device with pending commands will also be reset.
227.El
228.Sh EXAMPLES
229To erase
230.Pa wd2
231which is currently unfrozen and has no password set:
232.Bd -literal -offset indent
233# atactl wd2 security status
234	supported
235# atactl wd2 security setpass user
236Password:
237Confirm password:
238# atactl wd2 security status
239	supported
240	enabled
241# atactl wd2 security erase user
242Password:
243Erasing may take up to 0h 2m 0s...
244#
245.Ed
246.Sh SEE ALSO
247.Xr ioctl 2 ,
248.Xr wd 4 ,
249.Xr dkctl 8 ,
250.Xr drvctl 8 ,
251.Xr scsictl 8
252.Sh HISTORY
253The
254.Nm
255command first appeared in
256.Nx 1.4 .
257.Sh AUTHORS
258The
259.Nm
260command was written by Ken Hornstein.
261It was based heavily on the
262.Xr scsictl 8
263command written by Jason R. Thorpe.
264.Sh BUGS
265The output from the
266.Cm identify
267command is rather ugly.
268.Pp
269Support for master passwords is not implemented.
270.Pp
271The
272.Nx
273kernel behaves poorly with drives that have passwords set and are
274locked.
275