Encryption of folders and partitions

I would like to program with Ocaml a program for encryption of folders and partitions (similar to Vera Crypt).

How do I define the partition “E” with Ocaml under Windows or the drive “sda7” under Linux?

What are your suggestions?

It seems to me you’re asking how to do systems programming in OCaml under Windows and Linux. I have done quite a lot of systems programming in Linux using the Unix module. This is probably sufficient for reading and writing raw disks if that’s what you have in mind. (However you will need to know a lot about file systems, not an easy thing.)

I don’t know of the equivalent for Windows, though it may be just as straightforward for all I know. If not, you will probably need to write stubs in C and call them as external functions in your OCaml code.

They clearly need to do vastly more than that; they want to build a transparent encryption system in OCaml that acts like a file system. I didn’t bother answering before because it was clear that the bulk of the answer to the question has little to do with OCaml and a great deal to do with complicated features of the Windows and Linux kernels.

You can read this maybe:

Unix system programming in OCaml

Xavier Leroy and Didier Rémy