I have a laptop with Linux Slackware. When it's working on battery saving a file to hard drive takes around a second. When I'm writing code I waste a lot of time saving the files.

I have about 2 GB of free RAM, so I can use 1 GB as a temporary buffer. And work like this:

  1. Load the file into the RAM buffer.
  2. Work with the file and save it there.
  3. At the end of work the file is moved to the HDD.

The problem is that the file is a php script, used by Apache. So, I must somehow make the buffer transparent for it and make it use the RAM file when it's applying to the original file.

  • Not sure what you're asking here. You want to know how to create a ramdisk ? Or how to change an existing php script to make use of ramdisk ? – steve Aug 5 '15 at 21:56
  • @steve I want a ramdisk, but is not sure, how can I tell Apache to use the file from ramdisk. – user4035 Aug 5 '15 at 22:31
  • Read linuxatemyram.com – Basile Starynkevitch Aug 6 '15 at 7:50
  • @BasileStarynkevitch Will do. – user4035 Aug 6 '15 at 8:53

I think what you want to do is a bad idea, because in the case of a system crash you'll lose your work.

Anyway, you can use a subdir of /dev/shm to store your files; it's a tmpfs file system, which means it's kept in RAM.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.