aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2022-02-11 23:50:56 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2022-02-11 23:50:56 +0000
commitb3918431020005cc1fbf1d3fe836da0048c15c8c (patch)
tree8cbe98912fe835d3367ac1bcad6534c36bfdbed9
parent9939d8d804d0ce423824836173c296daf4e13e99 (diff)
downloadsg3_utils-b3918431020005cc1fbf1d3fe836da0048c15c8c.tar.gz
sg_format: allow disk formats on ZBC (zoned) disks
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@937 6180dd3e-e324-4e3e-922d-17de1ae2f315
-rw-r--r--ChangeLog3
-rw-r--r--doc/sg_format.825
-rw-r--r--src/sg_format.c6
3 files changed, 27 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 49400a3a..0483870a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,7 +2,7 @@ Each utility has its own version number, date of last change and
some description at the top of its ".c" file. All utilities in the main
directory have their own "man" pages. There is also a sg3_utils man page.
-Changelog for pre-release sg3_utils-1.48 [20220207] [svn: r936]
+Changelog for pre-release sg3_utils-1.48 [20220211] [svn: r937]
- sg_z_act_query: new utility for sending either a
Zone activate or Zone query command
- sg_rep_density: new utility for decoding the response of
@@ -26,6 +26,7 @@ Changelog for pre-release sg3_utils-1.48 [20220207] [svn: r936]
the left hand side of each line of hex
- sg_modes: improve handling of zbc disks with pdt=0x14
- sg_opcodes: cleanup error reporting
+ - sg_format: allow disk formats on ZBC (zoned) disks
- sg_lib: add sg_pdt_s_eq() to cope with ZBC disks which may
be either PDT_ZBC (if host managed) or PDT_DISK
- cleanup masks for PDT [0x1f] and group_number [0x3f]
diff --git a/doc/sg_format.8 b/doc/sg_format.8
index e642fa8c..89f6d000 100644
--- a/doc/sg_format.8
+++ b/doc/sg_format.8
@@ -1,4 +1,4 @@
-.TH SG_FORMAT "8" "January 2020" "sg3_utils\-1.45" SG3_UTILS
+.TH SG_FORMAT "8" "February 2022" "sg3_utils\-1.48" SG3_UTILS
.SH NAME
sg_format \- format, format with preset, resize SCSI disk; format tape
.SH SYNOPSIS
@@ -28,7 +28,11 @@ This utility issues one of three SCSI format commands: FORMAT UNIT, FORMAT
MEDIUM or FORMAT WITH PRESET. In the following description, unqualified
sections will usually be referring to the SCSI FORMAT UNIT command. Both
FORMAT UNIT and FORMAT WITH PRESET apply to disks (or disk\-like devices).
-The FORMAT MEDIUM command is for tapes.
+The FORMAT MEDIUM command is for tapes. A SCSI INQUIRY response categorizes
+the 'Peripheral Device Type' (PDT) of each SCSI device. This utility uses
+the PDT to check if there is a conflict between the \fIDEVICE\fR and the
+given option (e.g. giving the \fI\-\-tape=FM\fR option when \fIDEVICE\fR is
+a normal disk). If there is a conflict, this utility will not continue.
.PP
This utility can format modern SCSI disks and potentially change their block
size (if permitted) and the block count (i.e. number of accessible blocks on
@@ -201,6 +205,10 @@ commands are bypassed, leaving only the initial INQUIRY and FORMAT UNIT
commands. This is for emergency use (e.g. when the MODE SENSE/SELECT
commands are not working) and cannot change the logical block size.
.br
+Host managed zoned devices (e.g. many zoned disks) have a different PDT
+compared to other disks but can still be formatted as if they were 'normal'
+disks.
+.br
See NOTES section for implementation details and EXAMPLES section for typical
use.
.TP
@@ -550,6 +558,17 @@ provisioned formats typically complete faster than fully provisioned ones
on the same disk (see the \fI\-\-ip_def\fR option). In either case format
operations on SSDs tend to be a lot faster than they are on hard disks with
spinning media.
+.PP
+Host managed zoned devices (aka zoned disks) have a different Peripheral
+Device Type [PDT=20 or 0x14] from normal disks. They can be considered
+as a superset of normal disks (e.g. SSDs and hard disks) at least from
+the perspective of the number of SCSI commands they support. Typically
+they can be formatted just like other SCSI disks. They have their own
+T10 standards: ZBC standard (INCITS 536\-2016) and draft ZBC\-2.
+.br
+Two other zoned disk variants ("host aware" and "Domains and Realms") use
+the same PDT as other disks (i.e. PDT=0) and can be formatted by this
+utility as if they were normal disks.
.SH TAPE
Tape system use a variant of the FORMAT UNIT command used on disks. Tape
systems use the FORMAT MEDIUM command which is simpler with only three
@@ -695,7 +714,7 @@ Written by Grant Grundler, James Bottomley and Douglas Gilbert.
.SH "REPORTING BUGS"
Report bugs to <dgilbert at interlog dot com>.
.SH COPYRIGHT
-Copyright \(co 2005\-2020 Grant Grundler, James Bottomley and Douglas Gilbert
+Copyright \(co 2005\-2022 Grant Grundler, James Bottomley and Douglas Gilbert
.br
This software is distributed under the GPL version 2. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
diff --git a/src/sg_format.c b/src/sg_format.c
index 19d1203a..6c963af2 100644
--- a/src/sg_format.c
+++ b/src/sg_format.c
@@ -40,7 +40,7 @@
#include "sg_pr2serr.h"
#include "sg_pt.h"
-static const char * version_str = "1.65 20220127";
+static const char * version_str = "1.66 20220211";
#define RW_ERROR_RECOVERY_PAGE 1 /* can give alternate with --mode=MP */
@@ -1589,9 +1589,9 @@ main(int argc, char **argv)
pdt = PDT_MASK & inq_resp[0];
if (op->format) {
if ((PDT_DISK != pdt) && (PDT_OPTICAL != pdt) &&
- (PDT_RBC != pdt)) {
+ (PDT_RBC != pdt) && (PDT_ZBC != pdt)) {
pr2serr("This format is only defined for disks "
- "(using SBC-2 or RBC) and MO media\n");
+ "(using SBC-2+, ZBC or RBC) and MO media\n");
ret = SG_LIB_CAT_MALFORMED;
goto out;
}