RAMDISK

CLAUS GERHARDT

Date: May 13, 2012.

Contents

Contents
 1.  Introduction
 2.  The general backup management
 3.  The management of the RAM disk
 4.  The controlling structure of RAMDisk
 5.  The menu command „Create symlink for folder“
 6.  Running RAMDisk in the foreground/background
 7.  Emergency backup of Ramdisk
 8.  Requirements
 9.  Download Links
 10.  Links

1. Introduction

A RAM disk has the advantage that reading and writing data are extremely fast. In addition, no mechanical wear and tear or noise will occur. These properties make it the ideal storage place for files experiencing intensive read or write actions like databases or files which have to be temporarily saved very often, and also for games.

Since data in RAM are not permanently saved but will disappear when a shutdown or a restart occurs, it is absolutely necessary that important files residing on a RAM disk will be backupped in very short intervals.

RAMDisk offers an easy and comfortable management for a RAM disk and its contents and in addition it can serve as a general backup software for your hard disk. Files can be backupped in intervals as small as 1 second and folders in intervals as small as 1 minute.

Time Machine does an excellent job backing up your data every hour, however, it will not backup open files. RAMDisk will backup open files and also offers the possibility to backup individual files.

2. The general backup management

RAMDisk has a „Tasks“ menu containing several commands, among them are the commands Backup file and Backup folder. Choosing one of them will bring up three consecutive dialog windows to choose the source and target file/folder and the respective backup interval. In case of backing up a file the time interval has to be given in seconds and for a folder in minutes. RAMDisk will then start a new copy (clone) of itself running in the background that will monitor the source issuing the unix command

rsync -a source target

periodically. When the source will then differ from the target „rsync“ will make an (incremental) backup. The option „-a“ implies that subfolders are included recursively. Hence, specifying your home directory as source will imply that all files in your home directory will be included in the backup.

The home directory is also the largest directory which can be chosen as source, or more precisely, only sources contained in a writable directory are eligible, since RAMDisk will store a protocol file source.ramdisk in the directory containing the source—in case of the home directory a file Home.ramdisk will be placed in the home directory. These actions can be repeated arbitrarily often, i.e., different files or folders can be backupped. However, you should be aware that a folder backup is done recursively.

In general, it is recommended  to keep the number of backup
jobsin thelowsingle digits. Use Time Machineforbacking up
your complete hard disk and RAMDisk for special situations
like open files or folders containing open files or sources that
require a backup interval of less than one hour.

A backup job will be active as long as the protocol file exists and as long as the RAMDisk clones running in the background will be active, i.e., killing the clones, e.g., selecting a clone in the Activity Monitor (they will appear under the name RAMDisk without icon) and pressing the quit icon will give the opportunity to issue a Quit or a Force Quit command—a Quit will always suffice. However, in the Activity Monitor you won’t be able to specify a particular RAMDisk clone.

When  a particular backup job should be terminated, then the
corresponding protocol file should be deleted.

After a restart previous backup jobs won’t be restarted automatically. Instead you will have to choose the command Restart all backup jobs in HD for the jobs with sources in your hard disk and Restart all backup jobs in Ramdisk for those with sources in the RAM disk which is named „Ramdisk“ by default, see Section 3 for more details.

These commands will restart the respective jobs and before
startinga job RAMDisk willcheck ifthe sourceand targetare
available and, if thisisnotthecase, willshow acorresponding
warning ignoring the job.

More technical details about the management of the backup jobs can be found in Section 4.

3. The management of the RAM disk

The „Create RAM disk“ command in the Tasks menu will create a RAM disk, named Ramdisk, where you only have to specify its capacity in MB.

Note that a RAM  disk of capacity x MB will require 2x MB
of RAM  because of caching. Hence, it is recommended that
the capacity of your RAM disk should not exceed 1∕4 of the
available RAM,  unless of course there is plenty of RAM. In
most cases 100 MB will suffice for the RAM disk or even less.

The capacity of the last RAM Disk created this way will always be stored in

~/Library/Application Support/RAMDisk/Preferences/RamdiskSize

and when, e.g., after a restart, you want to recreate the RAM disk this will achieved by the command Recreate last RAM disk.

Backing up files or folders in your RAM disk follows the same pattern as described in the previous section. However, for backing up the entire RAM disk there is a special command Backup RAM disk which will back up the contents of the RAM disk to the folder

~/Library/Application Support/RAMDisk/Ramdisk

You only have to specify the backup interval in minutes. The recommendation is 60 minutes.

When you have backupped your RAM disk at least once, then, after a restart, and after having used the command Recreate last RAM disk, you can use the command Restore the contents of last RAM disk, and finally Backup last RAM disk, where all required data will be looked up.

Similar to the previous command Restart all backups with sources in HD there exists a command Restart all commands with sources in Ramdisk.

Note that,when backing upthewhole RAM  diskto itsdefault
target,thecontents ofthe targetfolderwillalwaysbe identical
to that of the source, i.e., files that are not available in the
source will be deleted.

4. The controlling structure of RAMDisk

The actual backup of the files will be done by the unix binary „rsync“. RAMDisk only controls the backup jobs, i.e., source, target and backup interval and calls „rsync“ periodically. For each backup job a particular clone of RAMDisk is responsible running in the background, i.e., you won’t notice it like a normal application and also cannot quit it like you would normally do.

Quitting a background clone of RAMDisk is only possible in
the Activity Monitor as described above or by removing the
correspondingprotocolfileofthe source. Startinga new clone
for a source which is already controlled by a RAMDisk clone
wbialclk auuptomcaaltli.cally kill the older clone at the start of its next

A protocol file, which is a plain text file, contains the following data

period;source;target;time;BackupFile

Here, period denotes the length of the backup interval in seconds;  time stands for the machine time at which the corresponding clone has been created, i.e., it’s a time stamp, and will tell an older clone to quit if the time stamp is no longer correct; BackupFile represents the name of a job specific file in either

~/Library/Application Support/RAMDisk/BackupHD

or

~/Library/Application Support/RAMDisk/BackupRD

containing the data period;source;target;time of a backup job which are used by the two commands restarting all backup jobs with sources in the hard disk resp. the RAM disk.

There are also two commands for removing all protocol files in the home directory resp. in the RAM disk, which will terminate any backup job and kill any active clone at the start of the next respective backup.

5. The menu command „Create symlink for folder“

To increase the performance or to reduce the wear and tear of your hard disk it is desirable to copy certain folders, like caches, to the Ramdisk replacing the original folders by a symbolic link pointing to the copy in the Ramdisk. The menu item „Create symlink for folder“ in the „Tasks“ menu will copy a chosen folder to the Ramdisk, and replace the folder by a symbolic link. Safari’s cache folder

~/Library/Caches/com.apple.Safari

is one of these folders which could be replaced by a symlink.

Note, however, that an action like this should be accompanied by either backing up the whole Ramdisk or that particular folder.

6. Running RAMDisk in the foreground/background

The RAMDisk application runs by default in the foreground where you have access to its menus. The clones are copies, or in unix speak, instances of RAMDisk running in the background. When a RAMDisk clone has been created RAMDisk still behaves like a normal application as long as it is open. As soon as it is has been closed, while clones are still active, it can no longer be restarted normally by double clicking. Instead one has either to kill all clones or use a script to restart RAMDisk.

A  script,  startRAMDisk “, for restarting RAMDisk, while
clones are ”running in the background, is stored in
~/Library/Application Support/RAMDisk/Scripts

Thus, RAMDisk should never be closed when clones are running, or the script has to be used for restarting it.

7. Emergency backup of Ramdisk

An emergency backup of Ramdisk will occur prior to a restart or shutdown provided a scheduled backup, initiated by one of the commands „Backup Ramdisk“ or „Backup last Ramdisk“, is active.

8. Requirements

RAMDisk requires Mac OS 10.6 or newer.

9. Download Links

RAMDisk in the Mac App Store: RAMDisk

10. Links

RAMDisk, Flashmode, Pdfselect Pro, Pdfselect, TEX Scripts, TeXOnline

URL: http://www.math.uni-heidelberg.de/studinfo/gerhardt/