Ciao lume.
A couple weeks ago I began tinkering with an operating system called Icaros, a desktop distribution of AROS, which is in turn a modern operating system designed to imitate and build upon the classic AmigaOS 3.1 environment. AROS comes with a "RAM Disk"--a fixed or dynamic partition of a computer's memory set asside to function as though it were a disk drive--loaded on the machine by default.
A RAM disk offers the benefit of storing and retrieving data more quickly than on an actual hard disk, as well as some security features thanks in part to the fact that any data stored on the disk will be removed on reboot. A RAM disk can be beneficial for numerous purposes, most commonly today to set as the location for browser cache to make visited webpages load faster (ideally on larger RAM disks with proper size limitations noted in one's browser cache settings). The use and benefit of RAM disks (which as far as I know have been around longer than permanent disk drives) will whither away with the replacement of spinning disk drives with static-state drives. For the moment, however, I found it an interesting enough concept that, despite the fact I have little to no apparent use for one, I decided to create a RAM disk that boots at each startup in Ubuntu 10.04 (Lucid).
There are a few easier ways to do this which you can easily google and bing yourself. I have found, however, that what most people consider today a RAM disk are actually disks that use both physical as well as virtual memory, the latter being stored on the hard drive and thus eliminating the purpose of having a RAM disk to begin with. I also made the decision that I wanted a RAM disk of fixed size, not a dynamic one (e.g. mounting
/dev/shm) which can take over up to half the system memory--I only have two gigabytes of RAM on my machine).
To do this, run:
sudo mkfs -t ext3 -q /dev/ram1 65536
sudo mkdir -p /media/ramdisk
sudo mount /dev/ram1 /media/ramdisk -o defaults,rw
(Where 65536 is the size in kilobytes, translating to an example size of 64 megabytes.)
The RAM disk should then be mounted on the desktop. To make this happen at system startup (for all users), run:
gksudo gedit /etc/rc.local
(Replace
gedit with your preferred editor, replacing
gksudo with the ordinary
sudo command for terminal-based, non-graphical editors.)
Making sure not to add anything after the line reading
exit 0, add the following to the file:
mkfs -t ext3 -q /dev/ram1 65536
mount /dev/ram1 /media/ramdisk -o defaults,rw
chmod 777 -R /media/ramdisk
A few additional tweaks: Setting the RAM disk up as an ext3 partition, a folder
lost+found is created every time the RAM disk is loaded at boot-up. I personally found this annoying. As you may know, to hide a file or folder (without having to rename it) in Gnome, you must create a file named
.hidden whose contents list the names of the file(s) you wish to hide and which must be stored in the same directory. To make this happen each time you log in, you can create a text file containing nothing but
lost+found, name it whatever you would like, and then store it somewhere obscure. Then create a basic script which copies that file to
/media/ramdisk/.hidden - The contents of the script can be as simple as:
#!/bin/bash
cp /home/user/example/hide_thing /media/ramdisk/.hidden &
Set the script to load when you log in by (System - Preferences - Startup Applications) setting the command to:
/the/location/of/your/script/./the_name_of_your_script.sh
The RAM disk I set up is viewable by all users of my system including my guest account. Any files that are stored to the RAM disk can be viewed by others users by logging out and switching sessions (as long as the machine is not rebooted). I decided to create a folder called
private on the RAM disk (which is automatically created every time I log in, which is only viewable only by me. To do this, add the following line to the script just shown:
mkdir /media/ramdisk/private && sleep 1s && chown YOU_USER_NAME -R /media/ramdisk/private && sleep 1s && chmod 700 -R /media/ramdisk/private &
Now all I have to do is find a use for this thing. This article will be grossly obsolete in a few months if it isn't already.