FreeBSD – Low-Level Disk Access

block-devicefreebsd

I'm developing a utility that needs to do low-level random access of disks (read individual sectors). In Linux I accomplish this by accessing the corresponding block device (e.g. /dev/sda). However, I've just installed FreeBSD, and I noticed that it doesn't have block devices. Instead, disks appear as character devices, which don't allow random "seeking".

Is there a way to accomplish this in FreeBSD? (i.e. low-level random access)

Best Answer

Disk character devices are equally if no more low level than block devices and are hopefully randomly seekable. One major difference between block devices and raw ones is the former are buffered while the latter are synchronous. That's the reason why FreeBSD dropped disk block devices.

Related Question