Is it possible to make ram drive in android?

RAM drive
A RAM drive (also called a RAM disk) is a block of random-access memory (primary storage or volatile memory) that a computer's software is treating as if the memory were a disk drive (secondary storage). RAM drives provide high-performance temporary storage for demanding tasks and protect non-volatile storage devices from wearing down, since RAM...
Android Enthusiasts Stack Exchange
Is it possible to create a RAMDisk / Ramdrive for Android 4.x?
Is it possible to create an auto-growing tmpfs ramdisk on a rooted Android 4.x? If yes, how?
19 Replies
TomIO
TomIO5w ago
In short, no.
tomikun
tomikun4w ago
eeeh why noot
twaik
twaik4w ago
Because termux is a regular app and has no superpowers...
tomikun
tomikun4w ago
but it says with root
TomIO
TomIO4w ago
Let me rephrase the question. Why would you wanna make a ramdisk on Android? What is that gonna do for you?
tomikun
tomikun4w ago
nothing, just sounds funny
Amigaba375
Amigaba375OP4w ago
I want to make temporary files, but I don't want to write them on disk, because I heard that ssd has a limited number of writes. By ramdisk I mean a disk that keeps all files in it in ram, and doesn't actually write anything in permanent storage. I tried to get it with this termux command, but all I got is "bad system call" message: mount -t tmpfs -o size=500m tmpfs ./ramfolder
tomikun
tomikun4w ago
youre overthinking it if ur worrying about reads and writes also /data/local/tmp is a tmpfs that android mounts, you can use that
Amigaba375
Amigaba375OP4w ago
Doesnt look like I can access that with material files easily.
tomikun
tomikun4w ago
material files is a horrible file explorer imo use total/ghost commander
Amigaba375
Amigaba375OP4w ago
Ghost commander has weird permissions, what do they do? Dont see total commander on f-droid.
tomikun
tomikun4w ago
because its closed source shareware https://www.ghisler.com/android.htm
Catinette
Catinette4w ago
https://www.ghisler.com/android.htm you should install it from the website, playstore version has limitations
Amigaba375
Amigaba375OP4w ago
The unrestricted version is still available in our forum, Android section.
Whats the difference? Feels like I'll need root access to write anything to /data/local/tmp.
twaik
twaik4w ago
Root or adb access actually.
tomikun
tomikun4w ago
i assumed you were already using root
FalconSN
FalconSN3w ago
You can mount tmpfs with the privileges you need to access /data/local/tmp, besides that, I don't think this path is tmpfs in all Android versions, it's not on my phone
twaik
twaik3w ago
/data/local/tmp is accessible with adb which is not enough to mount. Mounting is available only with root.
FalconSN
FalconSN3w ago
That makes sense. I also got a question. I mounted tmpfs to $TMPDIR with this command: mount -t tmpfs -o 'size=16m,uid=10160,gid=10160,mode=0777,fscontext="u:object_r:app_data_file:s0:c160,c256,c512,c768"' tmpfs $TMPDIR but it's not writable to termux user, can only write after setting selinux to permissive and the part in fscontext after :s0 is getting ripped off, what could be the problem?

Did you find this page helpful?