aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--README2
-rw-r--r--debian/changelog2
-rw-r--r--doc/sg_sanitize.836
-rw-r--r--sg3_utils.spec2
-rw-r--r--src/sg_sanitize.c16
6 files changed, 40 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index 181e6352..effec7cb 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 sg3_utils-1.37 [20130923] [svn: r518]
+Changelog for sg3_utils-1.37 [20130927] [svn: r519]
- sg_compare_and_write: fix wrprotect setting
- add --quiet option to suppress miscompare report
- merge features from another implementation
@@ -21,7 +21,8 @@ Changelog for sg3_utils-1.37 [20130923] [svn: r518]
- add --quiet option
- sg_xcopy: allow sg and bsg devices
- fix for bpt going negative
- - fix for seek in multi segment copies
+ - fix for seek in multi-segment copies
+ - sg_sanitize: skip 15 second safety delay with --fail
- sg_libs: extended copy opcode renamed (spc4r34)
- sg_ll_receive_copy_results(): expand for all sa_s
- add sg_get_sense_key()
diff --git a/README b/README
index fc9a1908..c4468614 100644
--- a/README
+++ b/README
@@ -396,4 +396,4 @@ See http://sg.danny.cz/sg/tools.html
Douglas Gilbert
-21st September 2013
+27th September 2013
diff --git a/debian/changelog b/debian/changelog
index e79c8a9c..69402db1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,7 +2,7 @@ sg3-utils (1.37-0.1) unstable; urgency=low
* New upstream version
- -- Douglas Gilbert <dgilbert@interlog.com> Thu, 19 Sep 2013 18:00:00 -0400
+ -- Douglas Gilbert <dgilbert@interlog.com> Fri, 27 Sep 2013 14:00:00 -0400
sg3-utils (1.36-0.1) unstable; urgency=low
diff --git a/doc/sg_sanitize.8 b/doc/sg_sanitize.8
index dae4f1f0..0e86bb90 100644
--- a/doc/sg_sanitize.8
+++ b/doc/sg_sanitize.8
@@ -1,4 +1,4 @@
-.TH SG_SANITIZE "8" "November 2012" "sg3_utils\-1.35" SG3_UTILS
+.TH SG_SANITIZE "8" "September 2013" "sg3_utils\-1.37" SG3_UTILS
.SH NAME
sg_sanitize \- remove all user data from disk with SCSI SANITIZE command
.SH SYNOPSIS
@@ -22,13 +22,15 @@ data.
Once a SCSI SANITIZE command has successfully started, then user data from
that disk is no longer available. Even if the disk is power cycled, the
sanitize operation will continue after power is re\-instated until it is
-complete.
+complete.
.PP
This utility requires either the \fI\-\-block\fR, \fI\-\-crypto\fR,
-\fI\-\-fail\fR or \fI\-\-overwrite\fR option. If the \fI\-\-quick\fR option
-is not given then the user is given 15 seconds to reconsider whether they
-wish to erase all the data on a disk. The disk's INQUIRY response strings
-are printed out just in case the wrong \fIDEVICE\fR has been given.
+\fI\-\-fail\fR or \fI\-\-overwrite\fR option. With the \fI\-\-block\fR,
+\fI\-\-crypto\fR or \fI\-\-overwrite\fR option the user is given 15 seconds
+to reconsider whether they wish to erase all the data on a disk, unless
+the \fI\-\-quick\fR option is given in which case the sanitize operation
+starts immediately. The disk's INQUIRY response strings are printed out just
+in case the wrong \fIDEVICE\fR has been given.
.PP
If the \fI\-\-early\fR option is given this utility will exit soon
after starting the SANITIZE command with the IMMED bit set. The user can
@@ -69,7 +71,8 @@ option is given this utility will exit "early" as soon as the sanitize
has commenced. This option and \fI\-\-wait\fR cannot both be given.
.TP
\fB\-F\fR, \fB\-\-fail\fR
-perform an "exit failure mode" sanitize operation.
+perform an "exit failure mode" sanitize operation. Typically requires the
+preceding SANITIZE command to have set the AUSE bit.
.TP
\fB\-h\fR, \fB\-\-help\fR
print out the usage information then exit.
@@ -102,7 +105,7 @@ pattern must be from 1 to the logical block size of the \fIDEVICE\fR.
.TP
\fB\-Q\fR, \fB\-\-quick\fR
the default action (i.e. when the option is not given) is to give the user
-15 seconds to reconsider doing a sanitize operation on the \fIDEVICE\fR.
+15 seconds to reconsider doing a sanitize operation on the \fIDEVICE\fR.
When this option is given that step (i.e. the 15 second warning period)
is skipped.
.TP
@@ -128,8 +131,8 @@ cryptographic erase operation could potentially be very quick.]
.SH NOTES
The SCSI SANITIZE command is closely related to the ATA SANITIZE command,
both are relatively new with the ATA command being the first one defined.
-It is likely that a SCSI to ATA Translation (SAT) definition will soon
-appear for the SCSI SANITIZE command (most likely in SAT\-3).
+The SCSI to ATA Translation (SAT) definition for the SCSI SANITIZE command
+appeared in the SAT\-3 revision 4 draft.
.PP
The SCSI SANITIZE command is related to the SCSI FORMAT UNIT command. It
is likely that a block erase sanitize operation would take a similar
@@ -143,7 +146,16 @@ then after power up any remaining user data will not be available and the
sanitize operation will continue. When a format is interrupted (e.g. the
disk is power cycled) the drafts say very little about the state of the
disk. In practice some of the original user data may remain and the format
-may need to be restarted.
+may need to be restarted.
+.PP
+Finding out whether a disk (SCSI or ATA) supports SANITIZE can be a
+challenge. If the user really needs to find out and no other information
+is available then try 'sg_sanitize \-\-fail \-vvv <device>' and observe
+the sense data returned may be the safest approach. Using the \fI\-\-fail\fR
+variant of this utility should have no effect unless it follows an already
+failed sanitize operation. If the SCSI REPORT SUPPORTED OPERATION CODES
+command (see sg_opcodes) is supported then using it would be a better
+approach for finding if sanitize is supported.
.SH EXAMPLES
These examples use Linux device names. For suitable device names in
other supported Operating Systems see the sg3_utils(8) man page.
@@ -190,7 +202,7 @@ Written by Douglas Gilbert.
.SH "REPORTING BUGS"
Report bugs to <dgilbert at interlog dot com>.
.SH COPYRIGHT
-Copyright \(co 2011\-2012 Douglas Gilbert
+Copyright \(co 2011\-2013 Douglas Gilbert
.br
This software is distributed under a FreeBSD license. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
diff --git a/sg3_utils.spec b/sg3_utils.spec
index 0b4ccc24..c72f9844 100644
--- a/sg3_utils.spec
+++ b/sg3_utils.spec
@@ -79,7 +79,7 @@ fi
%{_libdir}/*.la
%changelog
-* Thu Sep 19 2013 - dgilbert at interlog dot com
+* Fri Sep 27 2013 - dgilbert at interlog dot com
- track t10 changes
* sg3_utils-1.37
diff --git a/src/sg_sanitize.c b/src/sg_sanitize.c
index 3c7c7b1b..69c300a2 100644
--- a/src/sg_sanitize.c
+++ b/src/sg_sanitize.c
@@ -26,7 +26,7 @@
#include "sg_cmds_basic.h"
#include "sg_cmds_extra.h"
-static const char * version_str = "0.92 20130603";
+static const char * version_str = "0.93 20130927";
/* Not all environments support the Unix sleep() */
#if defined(MSC_VER) || defined(__MINGW32__)
@@ -44,6 +44,10 @@ static const char * version_str = "0.92 20130603";
#define SANITIZE_OP 0x48
#define SANITIZE_OP_LEN 10
+#define SANITIZE_SA_OVERWRITE 0x1
+#define SANITIZE_SA_BLOCK_ERASE 0x2
+#define SANITIZE_SA_CRYPTO_ERASE 0x3
+#define SANITIZE_SA_EXIT_FAIL_MODE 0x1f
#define DEF_REQS_RESP_LEN 252
#define SENSE_BUFF_LEN 64 /* Arbitrary, could be larger */
#define MAX_XFER_LEN 65535
@@ -160,13 +164,13 @@ do_sanitize(int sg_fd, const struct opts_t * op, const void * param_lstp,
memset(sanCmdBlk, 0, sizeof(sanCmdBlk));
sanCmdBlk[0] = SANITIZE_OP;
if (op->overwrite)
- sanCmdBlk[1] = 1;
+ sanCmdBlk[1] = SANITIZE_SA_OVERWRITE;
else if (op->block)
- sanCmdBlk[1] = 2;
+ sanCmdBlk[1] = SANITIZE_SA_BLOCK_ERASE;
else if (op->crypto)
- sanCmdBlk[1] = 3;
+ sanCmdBlk[1] = SANITIZE_SA_CRYPTO_ERASE;
else if (op->fail)
- sanCmdBlk[1] = 0x1f;
+ sanCmdBlk[1] = SANITIZE_SA_EXIT_FAIL_MODE;
else
return SG_LIB_SYNTAX_ERROR;
if (immed)
@@ -460,7 +464,7 @@ main(int argc, char * argv[])
wBuff[3] = (opts.ipl & 0xff);
}
- if (0 == opts.quick) {
+ if ((0 == opts.quick) && (! opts.fail)) {
printf("\nA SANITIZE will commence in 15 seconds\n");
printf(" ALL data on %s will be DESTROYED\n", device_name);
printf(" Press control-C to abort\n");