# Raw device

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Raw_device
> Markdown URL: https://mediated.wiki/source/Raw_device.md
> Source: https://en.wikipedia.org/wiki/Raw_device
> Source revision: 1310405644
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{Short description|Special kind of logical device to allow storage device to be accessed directly}}
In [computing](/source/computing), specifically in [Unix](/source/Unix) and [Unix-like](/source/Unix-like) operating systems, a '''raw device''' is a special kind of logical device associated with a character [device file](/source/device_file) that allows a storage device such as a [hard disk drive](/source/hard_disk_drive) to be accessed directly, bypassing the operating system's [caches](/source/Page_cache) and buffers (although the hardware caches might still be used). Applications like a [database management system](/source/database_management_system) can use raw devices directly, enabling them to manage how data is cached, rather than deferring this task to the operating system.

In [FreeBSD](/source/FreeBSD), all device files are in fact raw devices.  Support for non-raw devices was removed in FreeBSD&nbsp;4.0 in order to simplify buffer management and increase scalability and performance.<ref>{{cite web
| title=FreeBSD Architecture Handbook: 9.4. Block Devices (Are Gone)
| url=https://www.freebsd.org/doc/en/books/arch-handbook/driverbasics-block.html
| access-date=2017-06-29}}</ref>

In [Linux](/source/Linux), opening a block device with the {{Mono|O_DIRECT}} flag replaces raw device usage. Raw devices were removed entirely from the [Linux kernel](/source/Linux_kernel) in the 5.14 release.<ref>{{cite web
| url=https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=603e4922f1c81fc2ed3a87b4f91a8d3aafc7e093
| title=remove the raw driver
| first=Christoph
| last=Hellwig
| date=2021-05-31 
| access-date=2024-07-29}}</ref>  

== References ==
{{Reflist}}

{{Linux kernel}}
{{Unix}}

Category:Unix file system technology
Category:Linux kernel features

{{Linux-stub}}

---
Adapted from the Wikipedia article [Raw device](https://en.wikipedia.org/wiki/Raw_device) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Raw_device?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
