8 GB of RAM - Creating a RAM drive?

TwinAdk

Senior Member
Mar 15, 2011
949
321
93
Hi all!

Just an idea, would it be feasible to use say 2GB of RAM for a drive used to store pictures on, for even better performance? Or is the UFS 2.1 just as fast?

This is an idea for a custom ROM feature, hence the chosen forum section!

Kind Regards
TwinAdk
 
  • Like
Reactions: Saimonmarley

shazzy1

Senior Member
Nov 2, 2012
522
815
133
LPDDR4 is much faster, But as we know RAM is a volatile memory and what ever you do goes puff!!!


Unless we create a dump of the ram when rebooting/shutdown-ing
 

TwinAdk

Senior Member
Mar 15, 2011
949
321
93
LPDDR4 is much faster, But as we know RAM is a volatile memory and what ever you do goes puff!!!


Unless we create a dump of the ram when rebooting/shutdown-ing
Good point! Possibly create a control panel to control the usage of the ram drive, and have the content moved from RD to defined destination when the app that saves the data (camera app, download manager, Chrome, Firefox, etc) is no longer in focus?

And then symlink between locations so the system is left clueless :good::victory:

Great ideas here!! :cool:

Sent from my NEM-L21 using XDA Labs
 

ABotelho23

Senior Member
Jun 1, 2013
184
65
0
Ottawa
Linux probably supports RAM drives out of the box, so I doubt it would be that much work.

What the heck are you doing with pictures on a phone that you require better performance than UFS 2.1?
 

TwinAdk

Senior Member
Mar 15, 2011
949
321
93
Yeah, though that's general cache thoughts, this is the creation of a drive, usable by any app, or the user :) Great minds think alike!

Linux probably supports RAM drives out of the box, so I doubt it would be that much work.

What the heck are you doing with pictures on a phone that you require better performance than UFS 2.1?
I'm just thinking of the write speed that will increase. Then the content can be loaded off the drive when the user is leaving it idle. It will give an even better experience when writing stuff to disk. Do you see the potential that the users write command is done instantly, so the user can move on with things. The system can then handle the offload in the background when the user do not have to wait :cowboy::cowboy:

I would love that feature!

Kind Regards
TwinAdk

Sent from my NEM-L21 using XDA Labs
 

caki25

Senior Member
Oct 16, 2008
396
97
0
Kosice
Not sure if swap is still in use, but on my old Xperia (and a couple of others) swap was created as a RD and supposedly it helped a lot. With a beast like OP5 though not sure if that would help and if this is still in place and used .. I stopped following a couple threads when I broke that Xperia so kind of digging from memory :)
 

TwinAdk

Senior Member
Mar 15, 2011
949
321
93
Not sure if swap is still in use, but on my old Xperia (and a couple of others) swap was created as a RD and supposedly it helped a lot. With a beast like OP5 though not sure if that would help and if this is still in place and used .. I stopped following a couple threads when I broke that Xperia so kind of digging from memory :)
On older phones I guess RD makes more sense, but as long as RAM is faster than disk (and you have RAM to spare) RD makes some sense :p:silly:



Sent from my NEM-L21 using XDA Labs
 

davfiala

Senior Member
Oct 11, 2012
82
51
18
Budweis
Not sure if swap is still in use, but on my old Xperia (and a couple of others) swap was created as a RD and supposedly it helped a lot. With a beast like OP5 though not sure if that would help and if this is still in place and used .. I stopped following a couple threads when I broke that Xperia so kind of digging from memory :)
Swap created as ramdisk? That doesn't make any sense. Mounting a ramdisk as swap is worse than useless.
 
  • Like
Reactions: TwinAdk

caki25

Senior Member
Oct 16, 2008
396
97
0
Kosice
Swap created as ramdisk? That doesn't make any sense. Mounting a ramdisk as swap is worse than useless.
it does, if you use compression to sort of extend the size of the memory. If configured properly, it might bypass android's swappiness, but still keep the app's data in RAM for faster switchover. Not the most elegant solution, but it just might work. With so much memory that the OP5 has, that it can't really exhaust it, it's a bit pointless.

On older phones I guess RD makes more sense, but as long as RAM is faster than disk (and you have RAM to spare) RD makes some sense :p:silly:
Sent from my NEM-L21 using XDA Labs
yeah, agreed, was just thinking aloud. I don't see that much into the internals of Android, but as you said earlier, some sort of quick cache might be worth a shot.
 

yubimusubi

Senior Member
Mar 25, 2011
119
26
0
Running a ramdisk as a mount for /tmp is a common trick on Linux to make processes that write a lot of tempfiles run a bit faster. I don't know how Android handles tempfiles, but if it stores them all in one place like on GNU-style systems in should work as well. But I suspect not many Android apps write tempfiles anyway...
 

ABotelho23

Senior Member
Jun 1, 2013
184
65
0
Ottawa
Yeah, though that's general cache thoughts, this is the creation of a drive, usable by any app, or the user :) Great minds think alike!


I'm just thinking of the write speed that will increase. Then the content can be loaded off the drive when the user is leaving it idle. It will give an even better experience when writing stuff to disk. Do you see the potential that the users write command is done instantly, so the user can move on with things. The system can then handle the offload in the background when the user do not have to wait :cowboy::cowboy:

I would love that feature!

Kind Regards
TwinAdk

Sent from my NEM-L21 using XDA Labs
Of course the write speed will increase. But for pictures, would it not be negligible?
 

onicrom

Senior Member
Aug 8, 2010
266
54
0
using tmpfs would be much easier than a ramdisk.

off the top of my head you would need to work out a few things

if you wanted it to be 'persistent' you would need to run some kind of scheduled rsync or background process to sync the data (lsync) to a dir on the ufs filesystem

either way you open yourself to data loss if during the scheduled window, or during the lsync, the phone reboots or crashes

you would also need to write an init script to create the tmpfs mount and sync back the data from the ufs filesystem

What would be a good candidate for 'ultra fast data'? Maybe the dir the camera stores files? What about the cached data each app stores?... you would probably have to limit this to a certain set of apps because you could run into an issue with space depending on how large you make the tmpfs mount...is that even something possible? I can't remember I haven't look at where the cache is stored
 
  • Like
Reactions: TwinAdk

LOS ER

Member
Jul 8, 2017
11
0
0
I'm actually looking for a way to create a ramdisk on my OnePlus 3T.
Is there any detailed description/explanation of how to make one or if there are any apps available that can do it for me?
Respond asap.
 

Desmanto

Senior Member
Apr 2, 2014
407
443
0
I'm actually looking for a way to create a ramdisk on my OnePlus 3T.
Is there any detailed description/explanation of how to make one or if there are any apps available that can do it for me?
Respond asap.
Sorry to bump up old thread, but maybe other are googling and directed here. So I better post my finding here and maybe other can benefit.

I have been searching for the holy grail for so long and finally found it. I am using RN5 whyred and trying to reserve 100 MB RAM for temporary storage and file processing for my Automagic flow. It is meant to reduce write cycle on the emmc. I have been trying to mount tmpfs on the /storage/emulate/0 and found out not working, the file still stored on emmc. Because I tried to reboot and the file still there.

I am currently using custom ROM AEX 6.7 Pie 9.0. When I use command mount, I can find tmpfs is mounted on /storage/self. So I thought to create a new folder inside it and chmod 777, /storage/self/ramdrive. Then I copy file to it using MiXplorer. And the speed is amazing.

I then check on the command free | grep Shmem
The size is increasing, means the RAM is being used for the storage. Deleting the file will reduce it, so it is working !
Testing copying file to internal storage, 750 MB takes about 12 seconds, while copy to the ramdrive takes about 5 seconds. Leave the file at ramdrive and restart the phone, the file disappear. So it is confirmed that the file is stored at RAM.

So for other, if you want to mount ramdrive, you need root. You need at least terminal emulator. But MiXplorer with root access can also create the folder. Try to check your tmpfs file first using
Code:
mount | grep tmpfs
I found several and use /storage/self. So I create additional folder there
Code:
mkdir /storage/self/ramdrive
chmod 777 /storage/self/ramdrive
This folder disappear at every reboot, so I use Automagic startup to recreate it at every reboot.

I then point my flow to save or process file at that path. By default the limit is half from the total RAM, which is 2 GB from my 4 GB RAM. I am thinking to find the script to limit the size, but rather than playing with the mount script, I better disciplined my flow to not store too much here.

Using the ramdrive, now I can lavishly store and delete temporary file there without worrying reducing my emmc lifespan.