0

In order to bypass the operating system cache when reading a file, I used O_DIRECT flag when calling open(). In Wikipedia it says that there is no difference between the two. Yet, does defining a HD (or more specifically a partition) as a raw device allows to avoid using a file system? (In this Stack Overflow post a comment says it's impossible since a file system was already preformatted. )

Moreover, except from the file system question, If one can share a good guild for defining and working with raw device I would be really grateful.

2
  • Can you tell us a bit more about what you are trying to achieve? Jan 13, 2020 at 14:46
  • Well I execute some reading experiments to try and evaluate characteristic reading times. I was told that the file system itself might cause some overhead and I may try and use raw devices in order the eliminate this overhead. However, I wish to really understand that raw device might be of an aid, or it's redundant in case I use O_DIRECT flag. @EduardoTrápani Jan 13, 2020 at 14:59

1 Answer 1

1

No, accessing the raw device does not need a filesystem. Well, you could say you are using a virtual filesystem /dev but that's only needed to expose the name of the device, after that your i/o is going to the device.

But there are many levels of cache/buffering. Filesystem is just one of them, the system will have its own set and disk hardware does too. If you want to get even closer to the device you will need to access other interfaces.

You might be better off with an existing tool, say dd and hdparm. "Test disk i/o performance with dd" or "Disk Speed Test (Read/Write): HDD, SSD Performance in Linux".

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .