1.\" $NetBSD: dkctl.8,v 1.26 2016/01/06 23:01:11 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 6, 2016 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 addwedge Ar name Ar startblk Ar blkcnt Ar ptype 65Define a 66.Dq wedge 67on the specified disk starting at block number 68.Ar startblk 69and spanning 70.Ar blkcnt 71blocks. 72You need to create the partition first with 73.Xr fdisk 8 74or 75.Xr gpt 8 , 76.Nm 77will just name it. 78The wedge will have the volume name 79.Ar name 80and the partition type 81.Ar ptype . 82Valid choices for ptype would be 83.Ar unused , 84.Ar swap , 85.Ar ffs , 86.Ar lfs , 87.Ar ext2fs , 88.Ar cd9660 , 89.Ar ados , 90.Ar hfs , 91.Ar msdos , 92.Ar filecore , 93.Ar raidframe , 94.Ar ccd , 95.Ar appleufs , 96.Ar ntfs , 97and 98.Ar cgd . 99.Pp 100The device name of the virtual block device assigned to the wedge will be 101displayed after the wedge has been successfully created. 102See 103.Xr dk 4 104for more information about disk wedges. 105.It Ic badsector Ar flush | list | retry 106Used for managing the kernel's bad sector list for 107.Xr wd 4 108devices. 109The software bad sector list is only maintained if the option 110.Dq WD_SOFTBADSECT 111was specified on kernel configuration. 112.Bl -tag -width XflushXX -offset indent 113.It flush 114Clears the in kernel list of bad sectors. 115.It list 116Prints out the list of bad sector ranges recorded by the kernel. 117.It retry 118Flushes the in kernel list and then retries all of the previously recorded 119bad sectors, causing the list to self update. 120This option 121.Em can only 122be used with character devices. 123.El 124.It Ic delwedge Ar dk 125Delete the wedge specified by its device name 126.Ar dk 127from the specified disk. 128.It Ic getcache 129Get and display the cache enables for the specified device. 130.It Ic getwedgeinfo 131Display information about the specified disk wedge. 132.Ar device 133in this case is the wedge name. 134.It Ic keeplabel Op Ar yes | no 135Specify to keep or drop the in-core disklabel on the last close of 136the disk device. 137(Keep if 138.Ar yes 139is specified, drop if 140.Ar no 141is specified.) 142.It Ic listwedges 143List all of the wedges configured on the specified disk. 144.It Ic makewedges 145Delete all wedges configured on the specified disk, and autodiscover 146the wedges again. 147Wedges that are in use are not deleted and conflicting 148or overlapping wedges are not created. 149You need to list wedges to find out what has changed. 150.It Ic setcache Ar none | r | w | rw Op Ar save 151Set the cache enables for the specified device. 152The enables are as follows: 153.Bl -tag -offset indent -width XsaveX 154.It none 155Disable all caches on the disk. 156.It r 157Enable the read cache, and disable all other caches on the disk. 158.It w 159Enable the write cache, and disable all other caches on the disk. 160.It rw 161Enable both the read and write caches on the disk. 162.It save 163If specified, and the cache enables are savable, saves the cache 164enables in the disk's non-volatile parameter storage. 165.El 166.It Ic strategy Op Ar name 167Get and set the disk I/O scheduler (buffer queue strategy) on the 168drive. 169If you do not provide a 170.Ar name 171argument, the currently selected strategy will be shown. 172To set the bufq strategy, the 173.Ar name 174argument must be specified. 175.Ar name 176must be the name of one of the built-in kernel disk I/O schedulers. 177To get the list of supported schedulers, use the following command: 178.Bd -literal -offset indent 179$ sysctl kern.bufq.strategies 180.Ed 181.It Ic synccache Op Ar force 182Causes the cache on the disk to be synchronized, flushing all dirty 183write cache blocks to the media. 184If 185.Ar force 186is specified, the cache synchronization command will be issued even 187if the kernel does not believe that there are any dirty cache blocks 188in the disk's cache. 189.El 190.Pp 191Note: The 192.Ic addwedge 193and 194.Ic delwedge 195commands only modify the in-kernel representation of disks; for 196modifying information on the disks themselves, refer to 197.Xr fdisk 8 198or 199.Xr gpt 8 . 200.Sh SEE ALSO 201.Xr ioctl 2 , 202.Xr dk 4 , 203.Xr sd 4 , 204.Xr wd 4 , 205.Xr disklabel 5 , 206.Xr atactl 8 , 207.Xr fdisk 8 , 208.Xr gpt 8 , 209.Xr scsictl 8 210.Sh HISTORY 211The 212.Nm 213command first appeared in 214.Nx 1.6 . 215.Sh AUTHORS 216The 217.Nm 218command was written by 219.An Jason R. Thorpe 220of Wasabi Systems, Inc. 221