forked from ideamonk/Rambola
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
206 lines (140 loc) · 6.68 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
__ _ _
/__\ __ _ _ __ ___ | |__ ___ | | __ _
/ \/// _` | '_ ` _ \| '_ \ / _ \| |/ _` |
/ _ \ (_| | | | | | | |_) | (_) | | (_| |
\/ \_/\__,_|_| |_| |_|_.__/ \___/|_|\__,_|
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