Raw devices in C

Hi guys.

what is the benefits of using raw devices in programming?
which applications mostly use raw devices?
how can i use raw devices in C programs? is there any system calls or library functions?

There a more drawbacks to doing that than there are advantages. Oracle and other high I/O demand products usually will work with raw devices to bypass the overhead of a filesystem. This means Oracle keeps track of everything on the disk, like the location of data items.

Basically you are also bypassing security and other featuresprovided by the kernel/filesystem to gain I/O speed.

All of your code has to run as root, so it means you can damage the kernel itself quite easily.

This is how to create raw devices for RedHat Linux that you access via your driver code:
How To Add Raw Device Mapping In Red Hat Enterprise Linux 5?

You can call open, close, read & write on a raw device fd you get from calling open. If you are running as root.

1 Like