MFS: Using a RAM Filesystem
Introduction
MFS allows you to place a partition in RAM. The advantage is speed. The disadvantage is that you lose all modifications made to it after each reboot. With a simple rsync setup, this can be resolved, which I’ll show you how to do.
Configuration
Partition /tmp
The tmp directory is interesting to move into RAM since the data there is temporary anyway and doesn’t need to be stored on the filesystem. Edit the fstab file:
|
|
Nothing more needs to be done :-)
Partition /var
After installing the necessary packages (such as net-snmp, pftop, pfstat, screen…), configuring the crontab, and configuring chrooted services like bind or an Apache reverse proxy, we can begin setting up the /var partition in MFS by copying its content to the partition reserved for this purpose.
Note that from now on, all modifications to /var should be made from /mfs/var:
|
|
Now let’s edit the fstab:
|
|
Syncronisation of modifications
We’ll use rsync to update the data. Since we don’t need to have everything in real time, a weekly update can be sufficient. Install rsync:
|
|
Add this line to the root crontab:
|
|
And finally for machine shutdown:
|
|
References
Last updated 05 Jan 2009, 02:37 +0200.