{
    "content": [
        {
            "type": "text",
            "text": "# sg_prevent(8) (man)\n\n**Summary:** sgprevent - send SCSI PREVENT ALLOW MEDIUM REMOVAL command\n\n**Synopsis:** sgprevent [--allow] [--help] [--prevent=PC] [--verbose] [--version] DEVICE\n\n## Flags\n\n| Flag | Long | Arg | Description |\n|------|------|-----|-------------|\n| -a | --allow | — | allow medium removal. This is equivalent to setting to '--prevent=2'. Cannot be used with --prevent=PC option (i.e. eith |\n| -h | --help | — | output the usage message then exit. |\n| -p | --prevent | — | where PC is a prevent code value. Defined values are: 0 allows removal, 1 prevents re‐ moval (default), 2 allows persist |\n| -v | --verbose | — | increase the level of verbosity, (i.e. debug output). |\n| -V | --version | — | print the version string and then exit. |\n\n## See Also\n\n- sgstart(sg3utils)\n- sgpersist(sg3utils)\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (2 lines)\n- **DESCRIPTION** (8 lines)\n- **OPTIONS** (2 lines) — 5 subsections\n  - -a --allow (4 lines)\n  - -h --help (2 lines)\n  - -p --prevent (8 lines)\n  - -v --verbose (2 lines)\n  - -V --version (2 lines)\n- **EXIT STATUS** (3 lines)\n- **AUTHORS** (2 lines)\n- **REPORTING BUGS** (2 lines)\n- **COPYRIGHT** (4 lines)\n- **SEE ALSO** (5 lines)\n\n## Full Content\n\n### NAME\n\nsgprevent - send SCSI PREVENT ALLOW MEDIUM REMOVAL command\n\n### SYNOPSIS\n\nsgprevent [--allow] [--help] [--prevent=PC] [--verbose] [--version] DEVICE\n\n### DESCRIPTION\n\nSends  a  SCSI  PREVENT  ALLOW  MEDIUM REMOVAL command to DEVICE.  The default action of this\nutility is to prevent the removing or ejecting of the medium from a drive. This  is  done  by\nignoring the SCSI START STOP UNIT command (see sgstart) and ignoring the eject button on the\ndrive when the user presses it. Drives that hold removable disks, tape cartridges  or  cd/dvd\nmedia  typically implement this command.  The definition of the \"prevent\" codes for this com‐\nmand differ between disks and tapes (covered by SBC-3 and SSC-3) and cd/dvd  drives  (covered\nby MMC-5). The \"prevent codes\" described here are from MMC-5.\n\n### OPTIONS\n\nArguments to long options are mandatory for short options as well.\n\n#### -a --allow\n\nallow  medium removal. This is equivalent to setting to '--prevent=2'.  Cannot be used\nwith --prevent=PC option (i.e. either use no options (hence prevent removal), this op‐\ntion or --prevent=PC).\n\n#### -h --help\n\noutput the usage message then exit.\n\n#### -p --prevent\n\nwhere PC is a prevent code value. Defined values are: 0 allows removal, 1 prevents re‐\nmoval (default), 2 allows persistent removal  while  3  prevents  persistent  removal.\n\"Persistent\"  in  this  context means that the initiator (port) that successfully uses\ncode 3 blocks other initiators (ports) from allowing removal. A  \"persistent  prevent\"\nstate  can be cleared by the owner allowing persistent removal (code 2) or a power cy‐\ncle (or anything that resets the device (LU)) or some special commands  (e.g.  various\nservice actions of Persistent Reserve Out, see SPC-3).\n\n#### -v --verbose\n\nincrease the level of verbosity, (i.e. debug output).\n\n#### -V --version\n\nprint the version string and then exit.\n\n### EXIT STATUS\n\nThe  exit status of sgprevent is 0 when it is successful. Otherwise see the sg3utils(8) man\npage.\n\n### AUTHORS\n\nWritten by Douglas Gilbert.\n\n### REPORTING BUGS\n\nReport bugs to <dgilbert at interlog dot com>.\n\n### COPYRIGHT\n\nCopyright © 2004-2012 Douglas Gilbert\nThis software is distributed under a FreeBSD license. There is NO warranty; not even for MER‐\nCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n### SEE ALSO\n\nsgstart(sg3utils), sgpersist(sg3utils)\n\n\n\nsg3utils-1.35                              November 2012                              SGPREVENT(8)\n\n"
        }
    ],
    "structuredContent": {
        "command": "sg_prevent",
        "section": "8",
        "mode": "man",
        "summary": "sgprevent - send SCSI PREVENT ALLOW MEDIUM REMOVAL command",
        "synopsis": "sgprevent [--allow] [--help] [--prevent=PC] [--verbose] [--version] DEVICE",
        "flags": [
            {
                "flag": "-a",
                "long": "--allow",
                "arg": null,
                "description": "allow medium removal. This is equivalent to setting to '--prevent=2'. Cannot be used with --prevent=PC option (i.e. either use no options (hence prevent removal), this op‐ tion or --prevent=PC)."
            },
            {
                "flag": "-h",
                "long": "--help",
                "arg": null,
                "description": "output the usage message then exit."
            },
            {
                "flag": "-p",
                "long": "--prevent",
                "arg": null,
                "description": "where PC is a prevent code value. Defined values are: 0 allows removal, 1 prevents re‐ moval (default), 2 allows persistent removal while 3 prevents persistent removal. \"Persistent\" in this context means that the initiator (port) that successfully uses code 3 blocks other initiators (ports) from allowing removal. A \"persistent prevent\" state can be cleared by the owner allowing persistent removal (code 2) or a power cy‐ cle (or anything that resets the device (LU)) or some special commands (e.g. various service actions of Persistent Reserve Out, see SPC-3)."
            },
            {
                "flag": "-v",
                "long": "--verbose",
                "arg": null,
                "description": "increase the level of verbosity, (i.e. debug output)."
            },
            {
                "flag": "-V",
                "long": "--version",
                "arg": null,
                "description": "print the version string and then exit."
            }
        ],
        "examples": [],
        "see_also": [
            {
                "name": "sgstart",
                "section": "sg3utils",
                "url": "https://www.chedong.com/phpMan.php/man/sgstart/sg3utils/json"
            },
            {
                "name": "sgpersist",
                "section": "sg3utils",
                "url": "https://www.chedong.com/phpMan.php/man/sgpersist/sg3utils/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 2,
                "subsections": [
                    {
                        "name": "-a --allow",
                        "lines": 4,
                        "flag": "-a",
                        "long": "--allow"
                    },
                    {
                        "name": "-h --help",
                        "lines": 2,
                        "flag": "-h",
                        "long": "--help"
                    },
                    {
                        "name": "-p --prevent",
                        "lines": 8,
                        "flag": "-p",
                        "long": "--prevent"
                    },
                    {
                        "name": "-v --verbose",
                        "lines": 2,
                        "flag": "-v",
                        "long": "--verbose"
                    },
                    {
                        "name": "-V --version",
                        "lines": 2,
                        "flag": "-V",
                        "long": "--version"
                    }
                ]
            },
            {
                "name": "EXIT STATUS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "REPORTING BUGS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 5,
                "subsections": []
            }
        ]
    }
}