SG_PREVENT(8)
β¨ SG_PREVENT(8) β¨
okay so this is the SG_PREVENT(8) page from the SG3_UTILS crew π
it's all about sg_prevent and it is so iconic π«Ά
π NAME
sg_prevent - send SCSI PREVENT ALLOW MEDIUM REMOVAL command π¦
πΈ SYNOPSIS
sg_prevent [--allow] [--help] [--prevent=PC] [--verbose] [--version]
DEVICE
π DESCRIPTION
bestie, this one sends a SCSI PREVENT ALLOW MEDIUM REMOVAL command to DEVICE β¨ by default it's giving "nope, nobody is ejecting that disc" π
ββοΈ it stops the removing or ejecting of the medium from a drive. it does this by ignoring the SCSI START STOP UNIT command (see sg_start) and ignoring the eject button when someone presses it π drives that hold removable disks, tape cartridges or cd/dvd media usually implement this command, so it's lowkey everywhere π
ngl the "prevent" codes are a little different depending on what you're dealing with. for disks and tapes they're covered by SBC-3 and SSC-3, but for cd/dvd drives they're covered by MMC-5 π§ the "prevent codes" described on this page are the MMC-5 ones, so keep that in mind π«Ά
β¨ OPTIONS β¨
quick heads up: arguments to long options are mandatory for short options as well π
-a,--allowβ allows medium removal π this is the same as setting--prevent=2. it can't be mixed with the--prevent=PCoption, so pick one: no options at all (which means prevent removal), this one, or--prevent=PCπ-h,--helpβ shows the usage message and then exits π-p,--prevent=PCβPCis the prevent code value π the defined values are:0allows removal,1prevents removal (this is the default π),2allows persistent removal, and3prevents persistent removal. so "persistent" here means that whichever initiator (port) successfully uses code3blocks other initiators (ports) from allowing removal π a persistent prevent can be cleared by the owner allowing persistent removal with code2, by a power cycle, by anything that resets the device (LU), or by some special commands like various service actions of Persistent Reserve Out (see SPC-3) πΈ-v,--verboseβ turns up the verbosity, which means more debug output π-V,--versionβ prints the version string and then exits β
π· EXIT STATUS
if it works, sg_prevent exits with 0 β
if it doesn't, you'll need to check the sg3_utils(8) man page for the exit status π«Ά
π©βπ» AUTHORS
written by Douglas Gilbert π the legend himself β¨
π REPORTING BUGS
found a bug? report it to <dgilbert at interlog dot com> π¬ (that's the address as written in the page π)
π COPYRIGHT
Copyright Β© 2004-2012 Douglas Gilbert π
this software is distributed under a BSD-2-Clause license. there is NO warranty, not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE π use it with love but also with eyes open π
π¦ SEE ALSO
sg_start(sg3_utils), sg_persist(sg3_utils) π§
ok that's the whole tea π this page came from sg3_utils-1.35, dated November 2012, and it's all SG_PREVENT(8) π slay forever, bestie π β¨
π¦ where this page comes from
- alpine 3.24: sg3_utils-doc 1.48-r0 Β· BSD-2-Clause AND GPL-2.0-or-later
- arch rolling: sg3_utils 1.49-1 Β· GPL-2.0-or-later AND BSD-2-Clause
- centos-stream 10: sg3_utils 1.48-11.el10 Β· GPL-2.0-or-later AND BSD-2-Clause
- debian trixie: sg3-utils 1.48-3~deb13u1
- fedora 43: sg3_utils 1.48-10.fc43 Β· GPL-2.0-or-later AND BSD-2-Clause
- fedora 43: sg3_utils 1.48-6.fc43 Β· GPL-2.0-or-later AND BSD-2-Clause
- fedora 44: sg3_utils 1.48-10.fc44 Β· GPL-2.0-or-later AND BSD-2-Clause
- fedora 44: sg3_utils 1.48-8.fc44 Β· GPL-2.0-or-later AND BSD-2-Clause
- nixos 26.05: sg3_utils 1.48
- nixpkgs unstable: sg3_utils 1.49
- ubuntu questing: sg3-utils 1.48-2ubuntu1
- ubuntu resolute: sg3-utils 1.48-3ubuntu3
- ubuntu resolute: sg3-utils 1.48-3ubuntu3.2
- ubuntu stonking: sg3-utils 1.48-3ubuntu5
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms