1.\" $NetBSD: dkctl.8,v 1.23 2011/01/04 23:29:51 wiz Exp $ 2.\" 3.\" Copyright 2002 Wasabi Systems, Inc. 4.\" All rights reserved. 5.\" 6.\" Written by Jason R. Thorpe for Wasabi Systems, Inc. 7.\" 8.\" Redistribution and use in source and binary forms, with or without 9.\" modification, are permitted provided that the following conditions 10.\" are met: 11.\" 1. Redistributions of source code must retain the above copyright 12.\" notice, this list of conditions and the following disclaimer. 13.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" notice, this list of conditions and the following disclaimer in the 15.\" documentation and/or other materials provided with the distribution. 16.\" 3. All advertising materials mentioning features or use of this software 17.\" must display the following acknowledgement: 18.\" This product includes software developed for the NetBSD Project by 19.\" Wasabi Systems, Inc. 20.\" 4. The name of Wasabi Systems, Inc. may not be used to endorse 21.\" or promote products derived from this software without specific prior 22.\" written permission. 23.\" 24.\" THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND 25.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 26.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 27.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC 28.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34.\" POSSIBILITY OF SUCH DAMAGE. 35.\" 36.Dd January 5, 2011 37.Dt DKCTL 8 38.Os 39.Sh NAME 40.Nm dkctl 41.Nd program to manipulate disks 42.Sh SYNOPSIS 43.Nm 44.Ar device 45.Nm 46.Ar device 47.Ar command 48.Op Ar arg Op ... 49.Sh DESCRIPTION 50.Nm 51allows a user or system administrator to manipulate and configure disks 52in various ways. 53It is used by specifying a disk to manipulate, the command 54to perform, and any arguments the command may require. 55.Ar device 56is the disk (wdN, sdN, ...) containing the wedges unless noted otherwise. 57If 58.Nm 59is called without any command, it displays strategy, cache, and all of 60the wedges of the specified device. 61.Sh COMMANDS 62The following commands are supported: 63.Bl -tag -width XXstrategyXXnameXX 64.It Ic getcache 65Get and display the cache enables for the specified device. 66.It Ic setcache Ar none | r | w | rw Op Ar save 67Set the cache enables for the specified device. 68The enables are as follows: 69.Bl -tag -offset indent -width XsaveX 70.It none 71Disable all caches on the disk. 72.It r 73Enable the read cache, and disable all other caches on the disk. 74.It w 75Enable the write cache, and disable all other caches on the disk. 76.It rw 77Enable both the read and write caches on the disk. 78.It save 79If specified, and the cache enables are savable, saves the cache 80enables in the disk's non-volatile parameter storage. 81.El 82.It Ic synccache Op Ar force 83Causes the cache on the disk to be synchronized, flushing all dirty 84write cache blocks to the media. 85If 86.Ar force 87is specified, the cache synchronization command will be issued even 88if the kernel does not believe that there are any dirty cache blocks 89in the disk's cache. 90.It Ic keeplabel Op Ar yes | no 91Specify to keep or drop the in-core disklabel on the last close of 92the disk device. 93(Keep if 94.Ar yes 95is specified, drop if 96.Ar no 97is specified.) 98.It Ic badsector Ar flush | list | retry 99Used for managing the kernel's bad sector list for 100.Xr wd 4 101devices. 102The software bad sector list is only maintained if the option 103.Dq WD_SOFTBADSECT 104was specified on kernel configuration. 105.Bl -tag -width XflushXX -offset indent 106.It flush 107Clears the in kernel list of bad sectors. 108.It list 109Prints out the list of bad sector ranges recorded by the kernel. 110.It retry 111Flushes the in kernel list and then retries all of the previously recorded 112bad sectors, causing the list to self update. 113This option 114.Em can only 115be used with character devices. 116.El 117.It Ic addwedge Ar name Ar startblk Ar blkcnt Ar ptype 118Define a 119.Dq wedge 120on the specified disk starting at block number 121.Ar startblk 122and spanning 123.Ar blkcnt 124blocks. 125You need to create the partition first with 126.Xr fdisk 8 127or 128.Xr gpt 8 , 129.Nm 130will just name it. 131The wedge will have the volume name 132.Ar name 133and the partition type 134.Ar ptype . 135Valid choices for ptype would be 136.Ar unused , 137.Ar swap , 138.Ar ffs , 139.Ar lfs , 140.Ar ext2fs , 141.Ar cd9660 , 142.Ar ados , 143.Ar hfs , 144.Ar msdos , 145.Ar filecore , 146.Ar raidframe , 147.Ar ccd , 148.Ar appleufs , 149.Ar ntfs , 150and 151.Ar cgd . 152.Pp 153The device name of the virtual block device assigned to the wedge will be 154displayed after the wedge has been successfully created. 155See 156.Xr dk 4 157for more information about disk wedges. 158.It Ic delwedge Ar dk 159Delete the wedge specified by its device name 160.Ar dk 161from the specified disk. 162.It Ic getwedgeinfo 163Display information about the specified disk wedge. 164.Ar device 165in this case is the wedge name. 166.It Ic listwedges 167List all of the wedges configured on the specified disk. 168.It Ic strategy Op Ar name 169Get and set the disk I/O scheduler (buffer queue strategy) on the 170drive. 171If you do not provide a 172.Ar name 173argument, the currently selected strategy will be shown. 174To set the bufq strategy, the 175.Ar name 176argument must be specified. 177.Ar name 178must be the name of one of the built-in kernel disk I/O schedulers. 179To get the list of supported schedulers, use the following command: 180.Bd -literal -offset indent 181$ sysctl kern.bufq.strategies 182.Ed 183.El 184.Pp 185Note: The 186.Ic addwedge 187and 188.Ic delwedge 189commands only modify the in-kernel representation of disks; for 190modifying information on the disks themselves, refer to 191.Xr fdisk 8 192or 193.Xr gpt 8 . 194.Sh SEE ALSO 195.Xr ioctl 2 , 196.Xr dk 4 , 197.Xr sd 4 , 198.Xr wd 4 , 199.Xr disklabel 5 , 200.Xr atactl 8 , 201.Xr fdisk 8 , 202.Xr gpt 8 , 203.Xr scsictl 8 204.Sh HISTORY 205The 206.Nm 207command first appeared in 208.Nx 1.6 . 209.Sh AUTHORS 210The 211.Nm 212command was written by 213.An Jason R. Thorpe 214of Wasabi Systems, Inc. 215