LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   how to mount /usr/lib and other Dirs in RAM (https://www.linuxquestions.org/questions/linux-software-2/how-to-mount-usr-lib-and-other-dirs-in-ram-942694/)

origami-sheep 05-01-2012 05:13 AM

how to mount /usr/lib and other Dirs in RAM
 
i read that it can massively improve responsiveness to mount certain directories in RAM (one guy claimed it can make firefox open in under half a second)

i can see the benefit of doing this, but how would i go about doing so? in particular how could i get it to write the modified files back to /usr?

fyi the ones i think would have greatest impact are
/usr/bin /usr/sbin /usr/lib and /lib

fatmac 05-01-2012 09:10 AM

Quote:

Originally Posted by origami-sheep (Post 4667426)
i read that it can massively improve responsiveness to mount certain directories in RAM (one guy claimed it can make firefox open in under half a second)

i can see the benefit of doing this, but how would i go about doing so? in particular how could i get it to write the modified files back to /usr?

fyi the ones i think would have greatest impact are
/usr/bin /usr/sbin /usr/lib and /lib

Generally speaking, the idea of using ram to speed things up isn't really worth it, for most users.
(I believe some servers use it to speed access times to large databases, etc.)

Yes it can be done by creating a ram disk, copying to it, & remounting onto it.

If you're still interested, look up 'ram disks'.

TobiSGD 05-01-2012 12:02 PM

You have to create a custom initrd to do this, with a modified init-script that copies the contents of the directories to a tmpfs and then mounts that tmpfs as the directory you want to have in RAM.
I think it would be far easier to load the whole system in RAM, instead. Also, keep in mind that this will:
- have a negative effect on boot time.
- use much of your RAM, that can't be used for your applications. If you don't have enough RAM for the file-system and your applications the system will start to swap, which will slow down your system.
- only accelerate the first start of an application. If you have enough RAM to mount entire file-systems into it then your application will most likely be cached anyways after the first start.

So this can be a project for a nice learning experience, but I wouldn't recommend it for everyday use.


All times are GMT -5. The time now is 09:56 AM.