My ubuntu server has 24GB of RAM. I want to automatically create ramdisk on boot and load files from the /home/user1/ramdisk folder. When the system shuts down, I need to load files from ramdisk back to that directory. How can I acheive this?
feedback
|
|
Even though upstart can be used to do things like this, this can only be recommended under the premise that the user is aware that the data is volatile and may get lost. Consider the case where power is lost. There is no possible way the machine can react to that and quickly move your data from the ramdisk to your other storage. That means: it won't be safe for the data. Given that you want to mount it, you need super user privileges, which means you can also store the volatile data directly in | |||||||||||
feedback
|
|
As status_access_denied points out in his answer, this is not safe for the data as it will be lost should a power0out or other uncontrolled shutdown occur. Also, you are often better of letting the OS decide what to hold in RAM. If you devote a chunk of ram to specific files like this then it can not use it for other things like caching other files, VM memory, databases, and what-ever else your server is doing. If you want to make sure the data is in cache on boot (where it will stay if the memory genuinely isn't ever needed for anything else, you could run something like:
on boot. The above command will result in all the files being read and therefore passed through the caching sub-system. Debian and Ubuntu (and probably other distros) run the script
You'll find You could chuck the command in a cron job if you want the server to occasionally reread the files to reseed them in cache in case they have been pushed out by something else. | |||
|
feedback
|
