Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

create a ramdisk in C++ on linux

I need to make a ramfs an mount it to an directory in linux using c++. I want to make it like a user (no sudo).

I need to call an application on a file that i created and it will be often. Writing it to HDD is very slow.

I found just:

system("mkdir /mnt/ram");
system("mount -t ramfs -o size=20m ramfs /mnt/ram");

but that is not good. I want to be a regular user, and command mount can be called just as root. what can i do?

like image 425
microo8 Avatar asked Sep 27 '12 10:09

microo8


1 Answers

For a userspace ramfs solution, you can use python-fuse-ramfs.

like image 101
Janus Troelsen Avatar answered Sep 27 '22 22:09

Janus Troelsen