Bioctl

Last updated
bioctl
Original author(s) Marco Peereboom (2005)
Developer(s) The OpenBSD Project
Initial release23 August 2005;16 years ago (2005-08-23)
Repository /sbin/bioctl
Written in C
Operating system OpenBSD since 3.8 (2005); NetBSD since 4.0 (2007)
Type RAID management and system monitoring
Licence BSD licence
Website bioctl(8)

The bio(4) pseudo-device driver and the bioctl(8) utility implement a generic RAID volume management interface in OpenBSD and NetBSD. [1] [2] The idea behind this software is similar to ifconfig, where a single utility from the operating system can be used to control any RAID controller using a generic interface, instead of having to rely on many proprietary and custom RAID management utilities specific for each given hardware RAID manufacturer. [3] [4] [5] [6] [7] Features include monitoring of the health status of the arrays, controlling identification through blinking the LEDs and managing of sound alarms, and specifying hot spare disks. Additionally, the softraid configuration in OpenBSD is delegated to bioctl as well; whereas the initial creation of volumes and configuration of hardware RAID is left to card BIOS as non-essential after the operating system has already been booted. [4] Interfacing between the kernel and userland is performed through the ioctl system call through the /dev/bio pseudo-device.

Contents

Overview

The bio/bioctl subsystem is deemed to be an important part in OpenBSD's advocacy for open hardware documentation, and the 3.8 release title and the titular song were dedicated to the topic — Hackers of the Lost RAID. [5] [8] [9] The development took place during a time of controversy where Adaptec refused to release appropriate hardware documentation that was necessary in order for the make the aac(4) driver work reliably, which followed with OpenBSD disabling support for the driver. [9]

In the commentary to the 3.8 release, [9] the developers express the irony of hardware RAID controllers' supposed purpose of providing reliability, through redundancy and repair, whereas in reality many vendors expect system administrators to install and depend on huge binary blobs in order to be assess volume health and service their disk arrays. Specifically, OpenBSD is making a reference to the modus operandi of FreeBSD, where the documentation of the aac(4) driver for Adaptec specifically suggests enabling Linux compatibility layer in order to use the management utilities (where the documentation even fails to explain where exactly these utilities must be obtained from, or which versions would be compatible, evidently because the proprietary tools may have expired). [10] [11] [12]

Likewise, OpenBSD developers intentionally chose to concentrate on supporting only the most basic features of each controller which are uniform across all the brands and variations; specifically, the fact that initial configuration of each controller must still be made through card BIOS was never kept secret from any bio/bioctl announcement. [4] [5] This can be contrasted with the approach taken by FreeBSD, for example, where individual utilities exist for several independent RAID drivers, and the interface of each utility is independent of one another; specifically, as of March 2019, FreeBSD includes separate device-specific utilities called mfiutil, mptutil, mpsutil/mprutil and sesutil, [13] [14] [15] [16] , each of which provides many options with at least subtle differences in the interface for configuration and management of the controllers, contributes to code bloat, not to mention any additional drivers for which no such tool even exists as open-source software at all. [17] In OpenBSD 6.4 (2018), a dozen of drivers register with the bio framework. [1]

The drive sensors

Monitoring of the state of each logical drive is also duplicated into the hardware monitoring frameworks and their corresponding utilities on both systems where bioctl is available — hw.sensors with sensorsd in OpenBSD [4] and sysmon envsys with envstat and powerd in NetBSD. [18] For example, on OpenBSD since 4.2 release, the status of the drive sensors could be automatically monitored simply by starting sensorsd without any specific configuration being required. [19] More drivers are being converted to use the bio and sensors frameworks with each release. [20]

SES/SAF-TE

In OpenBSD, both SCSI Enclosure Services (SES) [21] and SAF-TE [22] are supported since OpenBSD 3.8 (2005) as well, both of which feature LED blinking through bio and bioctl (by implementing the BIOCBLINK ioctl), helping system administrators identify devices within the enclosures to service. Additionally, both the SES and SAF-TE drivers in OpenBSD feature support for a combination of temperature and fan sensors, PSU, doorlock and alarm indicators; all of this auxiliary sensor data is exported into the hw.sensors framework in OpenBSD, [4] and can be monitored through familiar tools like sysctl, SNMP and sensorsd.

As of 2019, in NetBSD, an older SES/SAF-TE driver from NASA from 2000 is still in place, which is not integrated with bio or envsys, but has its own device files with a unique ioctl interface, featuring its own custom SCSI-specific userland tooling; [23] [24] this older implementation was also available in OpenBSD between 2000 and 2005, and was removed 2005 (together with its userland tools) just before the new leaner bio- and hw.sensors-based alternative drivers were introduced; SES and SAF-TE are now kept as two separate drivers in OpenBSD, but don't require any separate custom userland utilities anymore, reducing the code bloat and the number of source lines of code.

Related Research Articles

In computing, a device driver is a computer program that operates or controls a particular type of device that is attached to a computer or automaton. A driver provides a software interface to hardware devices, enabling operating systems and other computer programs to access hardware functions without needing to know precise details about the hardware being used.

RAID is a data storage virtualization technology that combines multiple physical disk drive components into one or more logical units for the purposes of data redundancy, performance improvement, or both. This was in contrast to the previous concept of highly reliable mainframe disk drives referred to as "single large expensive disk" (SLED).

In computing, ASPI is an Adaptec-developed programming interface which standardizes communication on a computer bus between a SCSI driver module on the one hand and SCSI peripherals on the other.

A disk array controller is a device that manages the physical disk drives and presents them to the computer as logical units. It almost always implements hardware RAID, thus it is sometimes referred to as RAID controller. It also often provides additional disk cache.

Native Command Queuing

In computing, Native Command Queuing (NCQ) is an extension of the Serial ATA protocol allowing hard disk drives to internally optimize the order in which received read and write commands are executed. This can reduce the amount of unnecessary drive head movement, resulting in increased performance for workloads where multiple simultaneous read/write requests are outstanding, most often occurring in server-type applications.

The Advanced Host Controller Interface (AHCI) is a technical standard defined by Intel that specifies the operation of Serial ATA (SATA) host controllers in a non-implementation-specific manner in its motherboard chipsets.

sysctl Unix-like software that manages kernel attributes

sysctl is a software utility of some Unix-like operating systems that reads and modifies the attributes of the system kernel such as its version number, maximum limits, and security settings. It is available both as a system call for compiled programs, and an administrator command for interactive use and scripting. Linux additionally exposes sysctl as a virtual file system.

In computing, ioctl is a system call for device-specific input/output operations and other operations which cannot be expressed by regular system calls. It takes a parameter specifying a request code; the effect of a call depends completely on the request code. Request codes are often device-specific. For instance, a CD-ROM device driver which can instruct a physical device to eject a disc would provide an ioctl request code to do so. Device-independent request codes are sometimes used to give userspace access to kernel functions which are only used by core system software or still under development.

Super I/O

Super I/O is a class of I/O controller integrated circuits that began to be used on personal computer motherboards in the late 1980s, originally as add-in cards, later embedded on the motherboards. A super I/O chip combines interfaces for a variety of low-bandwidth devices. The functions below are usually provided by the super I/O if they are on the motherboard:

Data scrubbing is an error correction technique that uses a background task to periodically inspect main memory or storage for errors, then corrects detected errors using redundant data in the form of different checksums or copies of data. Data scrubbing reduces the likelihood that single correctable errors will accumulate, leading to reduced risks of uncorrectable errors.

pfsync is a computer protocol used to synchronise firewall states between machines running Packet Filter (PF) for high availability. It is used along with CARP to make sure a backup firewall has the same information as the main firewall. When the main machine in the firewall cluster dies, the backup machine is able to accept current connections without loss.

A proprietary device driver is a closed-source device driver published only in binary code. In the context of free and open-source software, a closed-source device driver is referred to as a blob or binary blob. The term usually refers to a closed-source kernel module loaded into the kernel of an open-source operating system, and is sometimes also applied to code running outside the kernel, such as system firmware images, microcode updates, or userland programs. The term blob was first used in database management systems to describe a collection of binary data stored as a single entity.

Vinum, is a logical volume manager, also called software RAID, allowing implementations of the RAID-0, RAID-1 and RAID-5 models, both individually and in combination. The original Vinum was part of the base distribution of the FreeBSD operating system since 3.0, and also NetBSD between 2003-10-10 and 2006-02-25, as well as descendants of FreeBSD, including DragonFly BSD; in more recent versions of FreeBSD, it has been replaced with gvinum, which was first introduced around FreeBSD 6. Vinum source code is maintained in the FreeBSD and DragonFly source trees. Vinum supports RAID levels 0, 1, 5, and JBOD. Vinum was inspired by Veritas Volume Manager.

lm_sensors Software tool

lm_sensors is a free open-source software-tool for Linux that provides tools and drivers for monitoring temperatures, voltage, humidity, and fans. It can also detect chassis intrusions.

In computer storage, SAF-TE is an industry standard to interface an enclosure to a (parallel) SCSI subsystem to gain access to information or control for various elements and parameters. These include temperature, fan status, slot status (populated/empty), door status, power supplies, alarms, and indicators. Practically, any given SAF-TE device will only support a subset of all possible sensors or controls.

In Unix-like operating systems, a device file or special file is an interface to a device driver that appears in a file system as if it were an ordinary file. There are also special files in DOS, OS/2, and Windows. These special files allow an application program to interact with a device by using its device driver via standard input/output system calls. Using standard system calls simplifies many programming tasks, and leads to consistent user-space I/O mechanisms regardless of device features and functions.

OpenBSD Security-focused Unix-like operating system

OpenBSD is a security-focused, free and open-source, Unix-like operating system based on the Berkeley Software Distribution (BSD). Theo de Raadt created OpenBSD in 1995 by forking NetBSD. According to the website, the OpenBSD project emphasizes "portability, standardization, correctness, proactive security and integrated cryptography."

NetBSD Open-source Unix-like operating system

NetBSD is a free and open-source Unix-like operating system based on the Berkeley Software Distribution (BSD). It was the first open-source BSD descendant officially released after 386BSD was forked. It continues to be actively developed and is available for many platforms, including servers, desktops, handheld devices, and embedded systems.

The sysctl hw.sensors framework is a kernel-level hardware sensors framework originating from OpenBSD, which uses the sysctl kernel interface as the transport layer between the kernel and the userland. As of 2019, the framework is used by over a hundred device drivers in OpenBSD to export various environmental sensors, with temperature sensors being the most common type. Consumption and monitoring of sensors is done in the userland with the help of sysctl, systat, sensorsd, ntpd, snmpd, ports/sysutils/symon and GKrellM.

The envsys framework is a kernel-level hardware monitoring sensors framework in NetBSD. As of 4 March 2019, the framework is used by close to 85 device drivers to export various environmental monitoring sensors, as evidenced by references of the sysmon_envsys_register symbol within the sys path of NetBSD; with temperature sensors, ENVSYS_STEMP, being the most likely type to be exported by any given driver. Sensors are registered with the kernel through sysmon_envsys(9) API. Consumption and monitoring of sensors from the userland is performed with the help of envstat utility through proplib(3) through ioctl(2) against the /dev/sysmon pseudo-device file, the powerd power management daemon that responds to kernel events by running scripts from /etc/powerd/scripts/, as well as third-party tools like symon and GKrellM from pkgsrc.

References

  1. 1 2 Niklas Hallqvist (2002); Marco Peereboom (2006). "bio(4) — block I/O ioctl tunnel pseudo-device". BSD Cross Reference. OpenBSD. Lay summary.
  2. Marco Peereboom (2005). "bioctl(8) — RAID management interface". BSD Cross Reference. OpenBSD. Lay summary.
  3. Federico Biancuzzi (2005-05-19). "OpenBSD 3.7: The Wizard of OS". ONLamp . O'Reilly Media. Archived from the original on 2005-05-21. Retrieved 2019-03-20.
  4. 1 2 3 4 5 Theo de Raadt (2005-09-09). "RAID management support coming in OpenBSD 3.8". misc@ (Mailing list). OpenBSD.
  5. 1 2 3 Federico Biancuzzi (2005-10-20). "OpenBSD 3.8: Hackers of the Lost RAID". ONLamp . O'Reilly Media. Archived from the original on 2005-12-27. Retrieved 2019-03-20.
  6. Federico Biancuzzi (2006-10-26). "OpenBSD 4.0: Pufferix's Adventures". ONLamp . O'Reilly Media. Archived from the original on 2007-03-10. Retrieved 2019-03-19.
  7. David Gwynne; Marco Peereboom (2006-12-03). bio and sensors in OpenBSD (PDF). OpenCON 2006, 2–3 December 2006. Courtyard Venice Airport, Venice/Tessera, Italy. Retrieved 2019-03-04.
  8. OpenBSD 3.8. OpenBSD. 2005-11-01. ISBN   0-9731791-6-3 . Retrieved 2019-03-23. Hackers of the Lost RAID
  9. 1 2 3 "3.8: "Hackers of the Lost RAID"". OpenBSD Release Songs. OpenBSD. 2005-11-01. Retrieved 2019-03-23.
  10. Scott Long; Adaptec, Inc (2000). "aac(4) — Adaptec AdvancedRAID Controller driver". BSD Cross Reference. FreeBSD. Lay summary. If the kernel is compiled with the COMPAT_LINUX option, or the aac_linux.ko and linux.ko modules are loaded,...
  11. "Remove expired aaccli". FreshBSD. FreeBSD. 2010-08-03. Archived from the original on 2010-08-03.
  12. Jonathan Gray (2006-12-02). "Page 26: Only open for business: FreeBSD". Driver Architecture and Implementation in OpenBSD. OpenCON 2006, 2–3 December 2006. Courtyard Venice Airport, Venice/Tessera, Italy. Retrieved 2019-03-27. drivers designed for binary only Linux RAID management tools
  13. "mfiutil — Utility for managing LSI MegaRAID SAS controllers". BSD Cross Reference. FreeBSD. 2009. Lay summary.
  14. "mptutil — Utility for managing LSI Fusion-MPT controllers". BSD Cross Reference. FreeBSD. 2009. Lay summary.
  15. "mpsutil, mprutil — Utility for managing LSI Fusion-MPT 2/3 controllers". BSD Cross Reference. FreeBSD. 2015. Lay summary.
  16. "sesutil — Utility for managing SCSI Enclosure Services (SES) device". BSD Cross Reference. FreeBSD. 2015. Lay summary.
  17. Theo de Raadt (2016-12-03). "Page 10: The hardware: drive controllers". Open Documentation for Hardware. OpenCON 2006, 2–3 December 2006. Courtyard Venice Airport, Venice/Tessera, Italy. Retrieved 2019-03-27. RAID management is almost completely undocumented
  18. Constantine A. Murenin (2010-05-21). "1.1. Motivation; 4. Sensor Drivers; 7.1. NetBSD envsys / sysmon". OpenBSD Hardware Sensors — Environmental Monitoring and Fan Control (MMath thesis). University of Waterloo: UWSpace. hdl:10012/5234. Document ID: ab71498b6b1a60ff817b29d56997a418.
  19. Federico Biancuzzi (2007-11-01). "Puffy's Marathon: What's New in OpenBSD 4.2". ONLamp . O'Reilly Media. Archived from the original on 2011-10-13. Retrieved 2019-03-03. Lay summary.
  20. Federico Biancuzzi (2009-06-15). "PuffyTron recommends OpenBSD 4.5". O'Reilly Media. Archived from the original on 2009-06-19. Retrieved 2019-03-19.
  21. David Gwynne (2005). "/sys/scsi/ses.c — SCSI Enclosure Services". BSD Cross Reference. OpenBSD. Lay summary.
  22. David Gwynne (2005). "/sys/scsi/safte.c — SCSI Accessed Fault-Tolerant Enclosure". BSD Cross Reference. OpenBSD. Lay summary.
  23. Matthew Jacob; National Aeronautics & Space Administration (2000). "dev/scsipi/ses.c — SCSI Environmental Services Driver". BSD Cross Reference. NetBSD. Lay summary.
  24. Matthew Jacob (2000). "sesd: sesd, getencstat, setencstat, setobjstat — monitor SCSI Environmental Services Devices". BSD Cross Reference. NetBSD. Lay summary.