Rambola Save

Set of shell scripts to manage persistent ramdisks on os x

Project README
               __                 _           _       
              /__\ __ _ _ __ ___ | |__   ___ | | __ _ 
             / \/// _` | '_ ` _ \| '_ \ / _ \| |/ _` |
            / _  \ (_| | | | | | | |_) | (_) | | (_| |
            \/ \_/\__,_|_| |_| |_|_.__/ \___/|_|\__,_|

based on QuickSander's [1] Cache2RAM script [2] improvised for data retainment done right on logout/restart/shutdown/schedule

Author : Abhishek Mishra

What is this?

A bunch of scripts to manage a RamDisk on your mac.

Why use a RamDisk?

To cache the shit you want to fly fast across the fans :D or, have a look at these XBench results -

HDD -
=====
    Sequential	114.94	
    	Uncached Write	116.50	65.92 MB/sec [256K blocks]
    	Uncached Read	140.07	70.40 MB/sec [256K blocks]

    Random	33.36	
    	Uncached Write	103.96	33.28 MB/sec [256K blocks]
    	Uncached Read	117.44	21.79 MB/sec [256K blocks]

RamDisk -
=========
    Sequential	973.74	
    	Uncached Write	2530.99	1432.04 MB/sec [256K blocks]
    	Uncached Read	2907.41	1461.24 MB/sec [256K blocks]
    Random	3551.18	
    	Uncached Write	4954.97	1586.27 MB/sec [256K blocks]
    	Uncached Read	7848.65	1456.37 MB/sec [256K blocks]

What do I use it for?

Ever since I put those 2 4gig sticks, I've been caching these on RamDisk - * eclipse workspace, projects * eclipse plugins * android sdk platforms, whichever I'm working on * JavaVirtualMachines under /System/Library/Java/ * Chrome cache and Application Support/Google/Chrome folder * Safari, Firefox cache * Finder's cache (quite a boost) * iCal, iChat (from ~/Library as well as ~/Library/Caches, iCal has become instant) * Skype, twitter, 1Password cache * ~/Music/iTunes (iTunes Media has been kept outside and symlinked into ~/Music/iTunes)

Just symlink whatever you wish into the RamDisk. Checkout the Safari example at http://hints.macworld.com/article.php?story=2011010204203424

How do I use this?

First, get this done - http://www.bombich.com/rsync.html

Do this - /usr/local/bin/rsync --version and you should see the following -

rsync version 3.0.7 protocol version 30 Copyright (C) 1996-2009 by Andrew Tridgell, Wayne Davison, and others. Web site: http://rsync.samba.org/ Capabilities: 64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints, socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace, append, ACLs, xattrs, no iconv, symtimes, file-flags

rsync comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. See the GNU General Public Licence for details.

Now if that's all fine and set, do the following on a terminal - cd ~/Applications git clone https://[email protected]/ideamonk/Rambola.git cd Rambola ./enable.sh

This shall push Rambola into your Login/Logout Hooks. Just logout and log back in to see a RamDisk mounted in Finder.

How do I disable this?

Say you have Rambola in ~/Applications/Rambola, do this on a terminal -

~/Applications/Rambola/disable.sh

How do I update to latest version?

I haven't figured out a clean way yet. This might make you lose the changes you made in helper.sh. So it's upto you to restore them.

Say you have Rambola in ~/Applications/Rambola, do this on a terminal -

cd ~/Applications/Rambola
git checkout .
git pull

Now edit src/helper.sh and put back your settings in case you changed any. Logout and login back to make latest script work.

How do I change the RamDisk size?

Get into Rambola's folder, open helper.sh under src & change the number there -

RAMDISK_SIZE=1024 # Size in Mega Bytes.

How do I retain RamDisk data?

By default Rambola keeps a synced backup into ~/Library/CachesSnapshotRamDisk. It syncs the RamDisk every time you logout/restart/shutdown and restores when you start your machine back. If worried about power-cuts, then by default, Rambola also syncs the backup every 45 minutes in background.

Have I tested RamDisk retainment?

I've tested that while development, but I do not guarantee anything. So, do test it out before copy-&-symlinking anything precious into the RamDisk. Also, I've used/tested it on OS X 10.6.8 only.

How do I figure out what's happening in the background?

Open OS X's Console (fire from spotlight, or Applications->Utilities), and just filter for Rambola to see what happened and is happening.

How do I disable the 45 minute syncs running in background?

Get into Rambola's folder, open helper.sh under src and change - TIMELY_BACKUP=yes , into,

TIMELY_BACKUP=no

How do I change the time period for automatic background syncs?

Get into Rambola's folder, open helper.sh under src and change the number in this line - let SAFETY_BACKUP_INTERVAL=45 # backup interval in minutes

Does it support multiple users?

Once enabled, it should work for every user. Though I haven't tested it out.

Any caveats?

Oh yes, putting too many things into RamDisk might make the restoration that happens when you login, a bit slow. But how many times do we login back anyway.

In case you don't want things this way, you could make the rsync call that restores contents asynchronous by changing this - $AS_USER $RSYNC "${SNAPSHOT_LOCATION}" "${DEST}" into $AS_USER $RSYNC "${SNAPSHOT_LOCATION}" "${DEST}" & in src/helper.sh

However in that case do not cache anything that would be needed as soon as you log in. And there is now way to figure out if rsync call got over, other than looking into Console.

Here's another advantage of not doing the above and letting Rambola work as it is designed to. When Rambola runs as LoginHook, OS X stops loading any other startup apps (even finder, dock, etc) unless it restores the snapshot to RamDisk. This is good for us as now we can cache many of those frequently written folders under ~/Library

Why was this created?

Uh, I assumed QuickSander's sweet app Cache2RAM [2] to be too sweet to retain things on logout/restart/shutdown. Alas! I lost a bunch of good things I cached and had to modify to bend it to my own needs.

Have fun.

[1] http://hints.macworld.com/users.php?mode=profile&uid=1054078 [2] http://hints.macworld.com/article.php?story=2011010204203424

Open Source Agenda is not affiliated with "Rambola" Project. README Source: ideamonk/Rambola
Stars
44
Open Issues
4
Last Commit
11 years ago
Repository
License

Open Source Agenda Badge

Open Source Agenda Rating