As defined by the project itself, util-linux is a random collection of Linux® utilities. This project is hosted on GitHub. This project generally packaged in most distributions under the name util-linux and installed by default.
Among many utilities, util-linux provides the lsblk and blkzone command line tools to list zoned block devices and to obtain zone configuration. The blkzone tool also allows resetting write pointer of sequential zones.
These utilities are especially useful for shell scripting and for troubleshooting of zone management problems in user applications.
The lsblk command lists all block devices of a system, regardless of the block device type, that is, also including zoned block devices. The output of lsblk is as follows.
By default, there is no indication of the zone model of the listed block
devices. To discover this information, the option
-z can be used.
The output of lsblk can also be formatted as needed using the
-o option. For
instance, the following command will display block device names, size and zone
The blkzone command line utility allows listing (reporting) the zones of a
zoned block device and resetting the write pointer of sequential zones. Unlike
the sg_rep_zone and sg_reset_wp utilities of the
sg3utils project, blkzone relies on the kernel
ioctl() interface to perform zone report and zone reset
operations. SCSI commands are not issued directly to the device by blkzone.
blkzone command usage is as shown below.
The open, close and finish commands of blkzone are available with util-linux version 2.36 onward. The capacity command is available on the master branch.
For listing the zones of device, the following command can be used.
To restrict the range of zones reported, the options
can be used. For instance, to report only the first sequential zone of a disk
starting at sector 274726912, the following command can be used.
If zone capacity is smaller than zone size, the size listed in blockdev and lsblk is not indicating how much data that can be stored on on the zoned block device. The storage capacity of the device is the sum of the capacity of all zones.
For determining the storage capcity of a device in sectors, the following command can be used:
Sequential write zones can be reset with blkzone using the
For instance, to reset the first sequential zone of a disk starting at sector
274726912, the following command can be used.
If the range of zones specified with the
reset operation includes conventional
zones, the command will fail.
The user must exclude all conventional zones. With the disk used for the above example, all conventional zones are located between sector 0 and 274726912. The remaining of the disk is composed of sequential write zones. Therefore, the following command will reset write pointer in all zones.
This command results in the kernel looping over all sequential zone of the disk
and executing a zone reset command on each zone. This can be time consuming and
takes a significantly longer time compared to using the
sg_reset_wp command with the