0

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)

WampyCakes
  • 119
  • 1
  • 15
  • 2
    This is very unclear. Are you trying to code a RAMdisk filesystem in Java, and then somehow tie it into Windows so Windows assigns it a drive letter? That is most certainly not possible in pure Java as you would have implmement a Windows filesystem provider interface that could receive calls from the Windows kernel. – Jim Garrison Apr 19 '16 at 01:57
  • Why not use one of the many free RAM disks? How will yours be better? Note: under Unix it has one built in. – Peter Lawrey Apr 19 '16 at 02:02

1 Answers1

1

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.

Eugene Mayevski 'Callback
  • 43,492
  • 7
  • 62
  • 119