How to make an os call from rust programming to disk/drive?

I am new at rust, currently working on a distribute system for static data project in rust that should bypass the file system when reading and writing data to a disk/drive

Direct disk access isn't in Rust's standard library. See if there's a crate for it on crates.io.

But most likely you'd have to find appropriate system calls for it and write it about the same way you would do that in C. You may need bindgen to use C headers in Rust.

1 Like

If you're wanting to skip the filesystem and do direct disk access that'll probably require working with the kernel directly. Or at the very least using some really low level libc functions which wrap kernel calls and would be highly device/platform specific.

Doing something like that is a pretty advanced thing, even for a seasoned C programmer... Just out of curiosity, why are you wanting to bypass the filesystem? The main purpose of a filesystem is to provide a nice abstraction over the tricky world of low level programming.

1 Like