Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm trying to code a RAMDisk, but I don't know how to mount a drive in RAM. I'm going to be writing this in Java. But could anyone point me to the way of making the disk in RAM with a letter and name.

Thanks!

EDIT: For clarification, I want to make a file with virtual files like stored in RAM. DataRam's Ramdisk is a good example of what I want to do. It creates a file and mounts a drive. The drive is in RAM and it writes to the file. How can I achieve this? (I wanted to create a RAMDisk for my own project with extended ideas)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
212 views
Welcome To Ask or Share your Answers For Others

1 Answer

RAMDisk (as well as any other virtual device) requires a device driver to be used. Luckily, device drivers are not written in Java or C# (especially Xamarin, which is for mobile OS that don't allow virtual disks at all). While you can use Java for business logic, some part of your project would need to be written in unmanaged language, and the project itself should include a device driver. No need to say, that device drivers are different for each operating system.

Now, the virtual disks can be of several kinds - the one where you have an image formatted to certain filesystem and handle block-level requests, and the one where you handle filesystem requests and implement the file system on its own.

We have products for both cases (CallbackDisk and Callback File System respectively). They both have samples for creating a virtual disk, but only Callback File System includes Java API to use. Both products are for Windows.

On Linux there exists FUSE to implement various filesystems, on OSX there exists OSXFUSE, a port of FUSE.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...