1SG_PREVENT(8) SG3_UTILS SG_PREVENT(8)
2
3
4
6 sg_prevent - send SCSI PREVENT ALLOW MEDIUM REMOVAL command
7
9 sg_prevent [--allow] [--help] [--prevent=PC] [--verbose] [--version]
10 DEVICE
11
13 Sends a SCSI PREVENT ALLOW MEDIUM REMOVAL command to DEVICE. The
14 default action of this utility is to prevent the removing or ejecting
15 of the medium from a drive. This is done by ignoring the SCSI START
16 STOP UNIT command (see sg_start) and ignoring the eject button on the
17 drive when the user presses it. Drives that hold removable disks, tape
18 cartridges or cd/dvd media typically implement this command. The defi‐
19 nition of the "prevent" codes for this command differ between disks and
20 tapes (covered by SBC-3 and SSC-3) and cd/dvd drives (covered by
21 MMC-5). The "prevent codes" described here are from MMC-5.
22
24 Arguments to long options are mandatory for short options as well.
25
26 -a, --allow
27 allow medium removal. This is equivalent to setting to '--pre‐
28 vent=2'. Cannot be used with --prevent=PC option (i.e. either
29 use no options (hence prevent removal), this option or --pre‐
30 vent=PC).
31
32 -h, --help
33 output the usage message then exit.
34
35 -p, --prevent=PC
36 where PC is a prevent code value. Defined values are: 0 allows
37 removal, 1 prevents removal (default), 2 allows persistent
38 removal while 3 prevents persistent removal. "Persistent" in
39 this context means that the initiator (port) that successfully
40 uses code 3 blocks other initiators (ports) from allowing
41 removal. A "persistent prevent" state can be cleared by the
42 owner allowing persistent removal (code 2) or a power cycle (or
43 anything that resets the device (LU)) or some special commands
44 (e.g. various service actions of Persistent Reserve Out, see
45 SPC-3).
46
47 -v, --verbose
48 increase the level of verbosity, (i.e. debug output).
49
50 -V, --version
51 print the version string and then exit.
52
54 The exit status of sg_prevent is 0 when it is successful. Otherwise see
55 the sg3_utils(8) man page.
56
58 Written by Douglas Gilbert.
59
61 Report bugs to <dgilbert at interlog dot com>.
62
64 Copyright © 2004-2012 Douglas Gilbert
65 This software is distributed under a FreeBSD license. There is NO war‐
66 ranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR‐
67 POSE.
68
70 sg_start(sg3_utils), sg_persist(sg3_utils)
71
72
73
74sg3_utils-1.35 November 2012 SG_PREVENT(8)