SG_BG_CTL(8)
π NAME π
okay so the manual name here is sg_bg_ctl(8), from the sg3_utils toolkit, and it's all about sending a SCSI BACKGROUND CONTROL command π§
sg_bg_ctl β send SCSI BACKGROUND CONTROL command β¨
π SYNOPSIS π
sg_bg_ctl [--ctl=CTL] [--help] [--time=TN] [--verbose] [--version]
DEVICE
πΈ DESCRIPTION πΈ
okay so this bad boy sends a SCSI BACKGROUND CONTROL command to the DEVICE π
It first showed up in the SBC-4 draft standard revision 8 (sbc4r08.pdf), and it lets you start and stop 'advanced background operations' on the DEVICE π₯
only resource or thin provisioned devices (logical units that are typically (solid state) disks) support this command, so don't expect it on just any drive π¦ And ngl, those advanced background operations often include garbage collection type stuff, which may degrade the disk's performance while they're running π
β¨ OPTIONS β¨
bestie, the long options need their arguments too, and that goes for the short ones as well π«Ά
-c,--ctl=CTLβ this is the value that goes into the BO_CTL field of the BACKGROUND CONTROL command (cdb) π It's a two bit field, so there are 4 variants:0leaves the host initiated advanced background operations alone,1starts them,2stops them, and3is reserved π The default is0.-h,--helpβ outputs the usage message, then exits π-t,--time=TNβTNis the maximum time that advanced background operations are allowed to run, measured in units of 100 ms (aka 1/10 second) β° This gets ignored unlessCTLis1. The default is0, which means there's no maximum time limit at all. You can only give values from0to255(that's 25.5 seconds, periodt) π The value goes into the BO_TIME field of the BACKGROUND CONTROL command.-v,--verboseβ cranks up the verbosity, so you get more debug output π-V,--versionβ prints the version string, then exits π§
π NOTES π
okay this part is lowkey important, so pay attention π€ According to T10, support for 'background control operations' is shown by the BOCS bit being set in the Block device characteristics VPD page [0xb1]. You can check that BOCS bit with the sg_vpd and sdparm utilities, and it's read only π
there's also a Background operations control mode page [0xa, 0x6] with a BO_MODE field that changes how this operation acts π
You can access and possibly modify that BO_MODE field with the sdparm utility. And the BO_STATUS field lives in the Background operation log page [0x15, 0x2], which you can view with the sg_logs utility β¨
the current draft covering this area is SBC-4 revision 10 (sbc4r10.pdf), in clause 4.33 . It has this example of a background operation, and it's giving real vibes: "Advanced background operation may include NAND block erase operations, media read operations, and media write operations (e.g., garbage collection), which may impact response time for normal read requests or write requests from the application client." π
π¦ EXIT STATUS π¦
if everything goes well, sg_bg_ctl exits with 0 π If not, check out the sg3_utils(8) man page for the other codes π«Ά
π AUTHORS π
written by Douglas Gilbert, the legend himself π«‘
π REPORTING BUGS π
report bugs to <dgilbert at interlog dot com> π¬
π COPYRIGHT π
Copyright Β© 2016 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 π
π SEE ALSO π
sg_vpd, sg_logs (sg3_utils); sdparm (sdparm) π§
okay bestie, that's the whole tea on sg_bg_ctl from sg3_utils-1.43, May 2016 πβ¨ stay iconic π πΈ
π¦ 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