J
J
juffinhalli2011-09-20 19:17:34
linux
juffinhalli, 2011-09-20 19:17:34

Linux root partition in RAM

Hi Habr!
There is a powerful computer with 16GB of RAM and a good UPS.
Linux runs on it and everything works well.
But the soul asks for the ideal of super speed in the system. Let's assume in advance that the issues of reliability and data safety in case of failures are relegated to the background.
We have already learned how to create ordinary disks in RAM, it's simple and clear. The "heavy" cache is already stored there.
But, I think, you can also throw the root partition into RAM. Let this, perhaps, increase the speed of loading and shutting down the system.
Live CD will not suit us, because. we need to save changes in the root partition.
The system partition (/) takes up 4 GB, there should be more than enough space in RAM.
Once I came across a manual for creating a “magic” usb flash drive from which the system image was unloaded into RAM and, when turned off, was unloaded back with changes. But, alas, so far nothing of the kind has been found.
Has anyone encountered such tasks?
Thank you in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2011-09-20
@juffinhalli

isn't it? reboot.pro/14547/

R
rPman, 2011-09-20
@rPman

Once upon a time I thought that it would be faster to load normally or copy the system image into memory and boot from it, the difference was insignificant and in the sense that it took longer to load the image into memory (more data was read), and if there was savings (if the system it’s good to clean it from unnecessary data), then only by reducing seek-to-seek requests.
If there is a lot of memory, then everything you need is easily cached (for example, with the simplest tar --one-file-system -c / > /dev/null , or even better, collect the list of necessary files yourself)
ps I also had experiments to speed up write caching (ignoring forced disable delayed write) using lvm + snapshots in ram:
1. create a block device in memory (the simplest one is configured by kernel options)
2. add the created image to the lvm group
3. create a snapshot, specifying the location for storing changes - this ram section
Now any write will be made to RAM, using it as efficiently as possible! (only changes, re-writing the sector does not increase memory requirements)
4. if necessary, save the changes - delete the snapshot, this will transfer all changes to the original partition, by the way, as efficiently as possible.
The cycle of creating and deleting a snapshot can be repeated periodically on the machine.
Google command examples, first query result linuxsoftware.co.nz/blog/2008/03/lvm-snapshot-with-no-free-diskspace
A very big drawback is that if the system does not shut down correctly, it will be necessary to repair the group (I didn’t dig much, there were errors with the structure), plus, of course, changes written to disk since the last snapshot were created will be lost, which is logical.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question