- NetBSD Manual Pages
DKCTL(8) NetBSD System Manager's Manual DKCTL(8)
Powered by man-cgi (2021-06-01).
Maintained for NetBSD
by Kimmo Suominen.
Based on man-cgi by Panagiotis Christias.
dkctl -- program to manipulate disks
dkctl device command [arg [...]]
dkctl allows a user or system administrator to manipulate and configure
disks in various ways. It is used by specifying a disk to manipulate,
the command to perform, and any arguments the command may require.
device is the disk (wdN, sdN, ...) containing the wedges unless noted
otherwise. If dkctl is called without any command, it displays strategy,
cache, and all of the wedges of the specified device.
The following commands are supported:
addwedge name startblk blkcnt ptype
Define a ``wedge'' on the specified disk starting at
block number startblk and spanning blkcnt blocks.
You need to create the partition first with fdisk(8)
or gpt(8), dkctl will just name it. The wedge will
have the volume name name and the partition type
ptype. Valid choices for ptype would be unused,
swap, ffs, lfs, ext2fs, cd9660, ados, hfs, msdos,
filecore, raidframe, ccd, appleufs, ntfs, cgd, and
The device name of the virtual block device assigned
to the wedge will be displayed after the wedge has
been successfully created. See dk(4) for more infor-
mation about disk wedges.
badsector flush | list | retry
Used for managing the kernel's bad sector list for
wd(4) devices. The software bad sector list is only
maintained if the option ``WD_SOFTBADSECT'' was spec-
ified on kernel configuration.
flush Clears the in kernel list of bad sec-
list Prints out the list of bad sector
ranges recorded by the kernel.
retry Flushes the in kernel list and then
retries all of the previously
recorded bad sectors, causing the
list to self update. This option can
only be used with character devices.
delwedge dk Delete the wedge specified by its device name dk from
the specified disk.
getcache Get and display the cache enables for the specified
getwedgeinfo Display information about the specified disk wedge.
device in this case is the wedge name.
keeplabel [yes | no]
Specify to keep or drop the in-core disklabel on the
last close of the disk device. (Keep if yes is spec-
ified, drop if no is specified.)
listwedges [-e] [-q]
List all of the wedges configured on the specified
disk. With -e exit with a non-zero exit status if
there are no wedges configured on that disk. With -q
(quiet mode) there is no output related to the wedges
that do, or do not, exist.
makewedges Delete all wedges configured on the specified disk,
and autodiscover the wedges again. Wedges that are
in use are not deleted and conflicting or overlapping
wedges are not created. You need to list wedges to
find out what has changed.
setcache none | r | w | rw [save]
Set the cache enables for the specified device. The
enables are as follows:
none Disable all caches on the disk.
r Enable the read cache, and disable all
other caches on the disk.
w Enable the write cache, and disable all
other caches on the disk.
rw Enable both the read and write caches
on the disk.
save If specified, and the cache enables are
savable, saves the cache enables in the
disk's non-volatile parameter storage.
strategy [name] Get and set the disk I/O scheduler (buffer queue
strategy) on the drive. If you do not provide a name
argument, the currently selected strategy will be
shown. To set the bufq strategy, the name argument
must be specified. name must be the name of one of
the built-in kernel disk I/O schedulers. To get the
list of supported schedulers, use the following com-
$ sysctl kern.bufq.strategies
synccache [force] Causes the cache on the disk to be synchronized,
flushing all dirty write cache blocks to the media.
If force is specified, the cache synchronization com-
mand will be issued even if the kernel does not
believe that there are any dirty cache blocks in the
Note: The addwedge and delwedge commands only modify the in-kernel repre-
sentation of disks; for modifying information on the disks themselves,
refer to fdisk(8) or gpt(8).
ioctl(2), dk(4), sd(4), wd(4), disklabel(5), atactl(8), fdisk(8), gpt(8),
The dkctl command first appeared in NetBSD 1.6.
The dkctl command was written by Jason R. Thorpe of Wasabi Systems, Inc.
NetBSD 10.99 March 29, 2020 NetBSD 10.99