xref: /openbsd/sbin/atactl/atactl.8 (revision 5af055cd)
1.\"	$OpenBSD: atactl.8,v 1.46 2015/02/28 21:51:57 bentley Exp $
2.\"	$NetBSD: atactl.8,v 1.5 1999/02/24 18:49:14 jwise Exp $
3.\"
4.\" Copyright (c) 1998 The NetBSD Foundation, Inc.
5.\" All rights reserved.
6.\"
7.\" This code is derived from software contributed to The NetBSD Foundation
8.\" by Ken Hornstein.
9.\"
10.\" Redistribution and use in source and binary forms, with or without
11.\" modification, are permitted provided that the following conditions
12.\" are met:
13.\" 1. Redistributions of source code must retain the above copyright
14.\"    notice, this list of conditions and the following disclaimer.
15.\" 2. Redistributions in binary form must reproduce the above copyright
16.\"    notice, this list of conditions and the following disclaimer in the
17.\"    documentation and/or other materials provided with the distribution.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29.\" POSSIBILITY OF SUCH DAMAGE.
30.\"
31.Dd $Mdocdate: February 28 2015 $
32.Dt ATACTL 8
33.Os
34.Sh NAME
35.Nm atactl
36.Nd a program to manipulate ATA (IDE) devices
37.Sh SYNOPSIS
38.Nm atactl
39.Ar device
40.Op Ar command Op Ar arg ...
41.Sh DESCRIPTION
42.Nm
43allows a user or system administrator to issue commands to and otherwise
44control devices which reside on standard IDE and ATA controllers.
45It is used by specifying
46a device to manipulate, a command to perform, and any arguments
47the command may require.
48.Pp
49.Nm
50supports the following commands:
51acousticdisable,
52acousticset,
53apmdisable,
54apmset,
55checkpower,
56dump,
57identify (the default),
58idle,
59poddisable,
60podenable,
61puisdisable,
62puisenable,
63puisspinup,
64readaheaddisable,
65readaheadenable,
66readattr,
67secdisablepass,
68secerase,
69secfreeze,
70secsetpass,
71secunlock,
72setidle,
73setstandby,
74sleep,
75smartautosave,
76smartdisable,
77smartenable,
78smartoffline,
79smartread,
80smartreadlog,
81smartstatus,
82standby,
83writecachedisable,
84and
85writecacheenable.
86.Pp
87Support for
88Self-Monitoring, Analysis, and Reporting Technology (SMART) functionality
89is indicated by the device with
90.Sq SMART feature set
91in the output of the
92.Li identify
93command.
94SMART commands and the
95.Li readattr
96command are for experts only.
97.Pp
98Support for
99Security Mode functionality
100is indicated by the device with
101.Sq Security Mode feature set
102in the output of the
103.Li identify
104command.
105.Em Be very careful
106while playing with these commands:
107loss of the user and master passwords for the device will result
108in an inaccessible device.
109.Pp
110A full description of the commands follows:
111.Pp
112.Bl -tag -width xxxxxxx -compact
113.It Li acousticdisable
114Disables support for automatic acoustic management on the specified device.
115Note that devices supporting automatic acoustic management may refuse to
116disable it, resulting in an
117.Sq ATA device returned Aborted Command
118warning.
119.Pp
120.It Li acousticset Ar acoustic-management-level
121Enables and sets the automatic acoustic management level to the requested
122level on the specified device (if supported).
123Device performance may
124increase with increasing automatic acoustic management levels at the cost of
125potentially generating more noise and requiring more power.
126Valid values are 0 up to and including 126.
127Support for automatic acoustic management is indicated by the device with
128.Sq Automatic Acoustic Management feature set
129in the output of the
130.Li identify
131command.
132.Pp
133.It Li apmdisable
134Disables support for advanced power management on the specified device.
135Note that devices supporting advanced power management may refuse to
136disable it, resulting in an
137.Sq ATA device returned Aborted Command
138warning.
139.Pp
140.It Li apmset Ar power-management-level
141Enables and sets the advanced power management level to the requested
142level on the specified device (if supported).
143Device performance may
144increase with increasing power management levels at the cost of
145potentially requiring more power.
146Values up to and including 126 allow
147the device to go into standby mode and spin-down the disk.
148This
149.Em may cause disk time-outs
150and is therefore
151.Em not
152recommended.
153These values are more suitable optimization for low power
154usage on infrequently used devices.
155Values 127 up to and including 253 do not allow the device to go to
156standby mode and are more suitable for optimization for performance.
157Support for advanced power management is indicated by the device with
158.Sq Advanced Power Management feature set
159in the output of the
160.Li identify
161command.
162.Pp
163.It Li checkpower
164Will print out if the device is in Active, Idle, or Standby power
165management mode.
166.Pp
167.It Li dump
168Extracts the records about issued ATA commands from the log buffer.
169The log buffer is cleared after extraction.
170.Pp
171.It Li identify
172Identify the specified device, displaying the device's vendor, product,
173revision strings, supported capabilities and enabled capabilities.
174This command is the default.
175.Pp
176.It Li idle
177Place the specified device into Idle mode.
178This mode may consume less power than Active mode.
179.Pp
180.It Li poddisable
181Disallows the specified device to revert to power-on default (pod) settings
182after a software reset.
183In other words this permits the settings that have been modified since
184power-on to remain after a software reset.
185.Pp
186.It Li podenable
187Allows the specified device to revert to power-on default (pod) settings
188after a software reset.
189.Pp
190.It Li puisdisable
191Disables power-up in standby (puis) on the specified device, causing the
192device to spin up the disks after power-up.
193This should be the factory
194default setting of the device and it is recommended to leave this
195setting disabled.
196.Pp
197.It Li puisenable
198Enables power-up in standby (puis) on the specified device, causing the
199device to wait while spinning up the disks after power-up.
200This may cause problems at boot if the device is too slow in spin-up.
201This option is therefore
202.Em not recommended
203unless the implications are understood.
204Note that the power-up in standby mode stays enabled over power-downs,
205hardware and software resets.
206Support for power-up in standby is indicated by the device with
207.Sq Power-up in standby feature set
208in the output of the
209.Li identify
210command.
211.Pp
212.It Li puisspinup
213Explicitly spins up the device if power-up in standby (puis) mode
214is enabled.
215.Pp
216.It Li readaheaddisable
217Disables read look-ahead on the specified device.
218This may decrease performance.
219Note that the device may use
220.Sq vendor specific
221behaviour in implementing this, so it is
222.Em not
223recommended to issue this command on a disk containing any currently
224mounted filesystems.
225.Pp
226.It Li readaheadenable
227Enables read look-ahead on the specified device.
228This may increase performance.
229Support for and status of read look-ahead is indicated by
230the device with
231.Sq read look-ahead
232in the output of the
233.Li identify
234command.
235.Pp
236.It Li readattr
237Displays attribute thresholds and values for the specified device.
238Besides attribute values, device vendors may provide additional information
239shown in the last column,
240.Dq Raw .
241Attributes names can be completely wrong since they vary between vendors and
242even models, so don't rely on it.
243SMART must be enabled while executing this command or the device will return
244an error.
245.Pp
246.It Li secdisablepass Ar user | master
247Disables the lock mode for the specified device with user or master password.
248This command won't change the master password.
249The master password will be reactivated when a user password is set.
250.Pp
251.It Li secerase Ar user | master Oo
252.Ar enhanced
253.Oc
254Erases all user data and unlocks the specified device.
255Execution of this command with the master password is the only way to unlock a
256device locked at maximum security level with the
257.Li secsetpass
258command if the user's password is lost or unknown.
259There are two erase modes: normal and enhanced.
260Default erase mode is normal.
261In the normal erase mode this command will write binary zeroes to
262all user data areas.
263The enhanced erase mode is optional and may not be supported by the device.
264When enhanced erase mode is specified, the device will write predetermined
265data patterns to all user data areas.
266In enhanced erase mode, all previously written user data will be overwritten,
267including sectors that are no longer in use due to reallocation.
268This command will disable the device lock mode, however, the master password
269will still be stored internally within the device and may be reactivated later
270when a new user password is set.
271.Pp
272.It Li secfreeze
273Prevents changes to passwords until a following power cycle.
274The purpose of this command is to prevent password setting attacks on the
275security system.
276After command completion any other commands that update the device lock mode
277will be aborted.
278.Pp
279.It Li secsetpass Ar user Ar high | maximum
280.It Li secsetpass Ar master
281Sets password and security level for the specified device.
282There are two passwords, user and master, and two security levels, high and
283maximum.
284The maximum password length is 32 symbols.
285The security system is enabled by sending a user password to the device with
286this command.
287When the security system is enabled, access to user data on the device is
288denied after a power cycle until the user password is sent to the device with
289the
290.Li secunlock
291command.
292A master password may be set in addition to the user password.
293The purpose of the master password is to allow an administrator to establish
294a password that is kept secret from the user, and which may be used to unlock
295the device if the user password is lost.
296Setting the master password does not enable security system.
297Each master password change decrements the master password revision
298code value which is displayed in the
299.Li identify
300command output if supported.
301After value 0x0001 is reached the next value will be 0xfffe.
302The security level determines device behavior when the master password is used
303to unlock the device.
304When the security level is set to high the device requires the
305.Li secunlock
306command if the master password is used to unlock.
307When the security level is set to maximum the device requires a
308.Li secerase
309command if the master password is used to unlock it.
310Execution of the
311.Li secerase
312command erases all user data on the device.
313.Pp
314.It Li secunlock Ar user | master
315Unlocks the specified device with user or master password.
316The device will always unlock if a valid user password is received.
317If the security level was set to high during the last
318.Li secsetpass
319command, the device will unlock if the master password is received.
320If the security level was set to maximum during the last
321.Li secsetpass
322command, the device won't unlock even if the master password is received.
323.Pp
324.It Li setidle Ar idle-timer
325Places the specified device into Idle mode, and sets the Idle timer to
326.Ar idle-timer
327seconds.
328A value of 0 will disable the Idle timer.
329.Pp
330.It Li setstandby Ar standby-timer
331Places the specified device into Standby mode, and sets the Standby timer
332to
333.Ar standby-timer
334seconds.
335A value of 0 will disable the Standby timer.
336.Pp
337.It Li sleep
338Place the specified device into Sleep mode.
339This mode will consume less power than Standby mode,
340but requires a device reset to resume operation.
341Typically the
342.Xr wd 4
343driver performs this reset automatically, but this should still be
344used with caution.
345.Pp
346.It Li smartautosave Ar enable | disable
347Enables/disables attribute autosave feature on the specified device.
348.Pp
349.It Li smartdisable
350Disables support for SMART on the specified device.
351Note that this means that the device will no longer record any SMART
352information.
353.Pp
354Note that SMART
355.Em must
356be enabled while executing the following commands or the device will
357return an error.
358.Pp
359.It Li smartenable
360Enables SMART (Self-Monitoring, Analysis, and Reporting Technology) on the
361specified device (if supported).
362This causes the device to record information
363for prediction of device degradation and/or faults.
364.Pp
365.It Li smartoffline Ar subcommand
366Causes the specified device to immediately initiate the optional set of
367activities that collect SMART data in off-line mode and then save this data
368to the device's non-volatile memory, or execute self-diagnostic test
369routines in either captive or off-line mode.
370The
371.Ar subcommand
372may be one of the following:
373.Pp
374.Bl -tag -width indent -compact
375.It Em abort
376Abort off-line mode self-test routine.
377.Pp
378.It Em collect
379Start SMART off-line data collection immediately.
380.Pp
381.It Em extencaptive
382Execute SMART extended self-test routine immediately in captive mode.
383.Pp
384.It Em extenoffline
385Execute SMART extended self-test routine immediately in off-line mode.
386.Pp
387.It Em shortcaptive
388Execute SMART short self-test routine immediately in captive mode.
389.Pp
390.It Em shortoffline
391Execute SMART short self-test routine immediately in off-line mode.
392.El
393.Pp
394Note that executing self-test routines in captive mode causes the device to
395be not accessible until the routine completes.
396This option is therefore
397.Em not recommended
398unless the implications are understood.
399.Pp
400.It Li smartread
401Reads various SMART information from the specified device and prints it to
402stdout.
403.Pp
404.It Li smartreadlog Ar log
405Reads specified
406.Ar log
407and prints it to stdout.
408The
409.Ar log
410may be one of the following:
411.Pp
412.Bl -tag -width "directoryXX" -offset indent -compact
413.It Em comp
414The comprehensive error log.
415.It Em directory
416The error log directory.
417.It Em selftest
418The self-test log.
419.It Em summary
420The summary error log.
421.El
422.Pp
423.It Li smartstatus
424Reads the reliability status of the specified device.
425If the device reports
426that one of its thresholds is exceeded (a strong indication of imminent
427failure), the warning
428.Sq SMART threshold exceeded!\&
429is printed to stderr and a status of 2 is returned.
430.Pp
431.It Li standby
432Place the specified device into Standby mode.
433This mode will consume less power than Idle mode.
434.Pp
435.It Li writecachedisable
436Disable the write cache on the specified device (if supported).
437This may decrease performance.
438Support for and status of write caching is indicated by the device with
439.Sq write cache
440in the output of the
441.Li identify
442command.
443.Pp
444.It Li writecacheenable
445Enables the write cache on the specified device (if supported).
446This may increase performance, however data still in the device's cache at
447powerdown
448.Em may be lost .
449The
450.Xr wd 4
451driver performs a cache flush automatically before shutdown.
452.El
453.Sh EXAMPLES
454Display the vendor, product, revision strings, and capabilities (such as
455SMART support) as reported by
456.Pa /dev/wd0 :
457.Pp
458.Dl # atactl /dev/wd0c identify
459.Pp
460Enable SMART support on
461.Pa /dev/wd0
462for detection of early warning signs of device failure:
463.Pp
464.Dl # atactl /dev/wd0c smartenable
465.Pp
466A
467.Xr crontab 5
468entry which queries
469.Pa /dev/wd0
470each hour for early warning signs of failure.
471If the device exceeds one of the SMART thresholds,
472.Nm
473will output
474.Sq SMART threshold exceeded!\&
475to stderr and
476.Xr cron 8
477will mail it.
478.Pp
479.Dl 0 * * * * /sbin/atactl /dev/wd0c smartstatus \*(Gt/dev/null
480.Sh SEE ALSO
481.Xr ioctl 2 ,
482.Xr wd 4
483.Sh HISTORY
484The
485.Nm
486command first appeared in
487.Ox 2.6 .
488Support for acoustic management, advanced power management, power-up in
489standby, read look-ahead, and SMART was added in
490.Ox 2.9 .
491.Sh AUTHORS
492.An -nosplit
493The
494.Nm
495command was written by
496.An Ken Hornstein .
497It was based heavily on the scsictl command written by
498.An Jason R. Thorpe .
499Support for acoustic management, advanced power management, power-up in
500standby, read look-ahead, and SMART was added by
501.An Wouter Slegers .
502.Sh CAVEATS
503Not all devices are created equally.
504Some may not support the feature sets
505and/or commands needed to perform the requested action, even when the
506.Li identify
507command indicates support for the requested action.
508The device will typically respond with an
509.Sq ATA device returned Aborted Command
510if the requested action is not supported.
511Similarly a device might not implement all commands in a feature set,
512so even though disabling a feature works, enabling might not.
513.Sh BUGS
514The output from the
515.Li identify
516command is rather ugly.
517.Pp
518Disabling read look-ahead with
519.Li readaheaddisable
520might cause problems with mounted filesystems on that device.
521