7

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)

1 Answer 1

6

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.

2
  • I see! I should have mentioned that I'm actually using Mono to read from the device using a FileStream object. Perhaps it's a Mono issue, then? I haven't yet tried using native fopen/fseek with it. (The FileStream throws an exception saying that "the stream does not support seeking") Commented Sep 9, 2013 at 0:09
  • Yep, it looks like Mono incorrectly treats character devices as un-seekable when opened as a FileStream. Thanks for the info! Commented Sep 9, 2013 at 20:32

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.