Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm getting a computer with 32 GB of memory and I'd like to allocate a good 8-16 GB to a RAM drive to boost performance of the files and programs that I open and close often. Simultaneously, I'm moving to encrypt more of the data that I store on my computer, including some of those files that I access quite often. For this reason, I'm interested in encrypting some part of the RAM drive by mounting a TC container stored inside the RAM drive. Do I risk corrupting or losing the data stored in the TC drive? If it's not risky, will the performance improvement on the RAM disk be similar to that of unencrypted files?

I've searched around online and haven't found a discussion of this issue. There is a reference to using a RAM disk on the TC FAQ, where they discuss mounting the drive so as not to leave traces of your use of TC. For this reason, I'm thinking it might be okay from a security/stability perspective, but that isn't explicitly stated, and there really isn't a discussion of it there or elsewhere. That FAQ answer also doesn't mention performance.

share|improve this question

closed as primarily opinion-based by Ƭᴇcʜιᴇ007, teylyn, Nifle, Darth Android, Excellll Jul 19 '13 at 21:31

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

3 Answers 3

Don't use a RAM disk for general system use. You are degrading overall system performance for a boost in a few files, and will end up wasting a LOT of memory for data that is never actually needed.

Let Windows use that 8-16GB of ram to boost performance of files and programs you use often, as it will be much, much more effective at finding the blocks on disk that you use most and keeping them in memory. Things like the NTFS journaling log, or the NTFS metadata blocks. If you use the truecrypt drive enough, then Windows will map the TC file into memory for you, transparently and behind the scenes. It will also automatically write any changes back to disk for you immediately.

I would worry about stability with writing anything to a RAM drive. If the system locks up, or you lose power, or for any reason can't copy the TC volume back to disk before the system shuts down... whoops, you just lost all your changes.

share|improve this answer
Regarding RAM disk vs cache performance, I read a couple articles on lifehacker and pcworld that indicate that RAM drives have the potential to boost performance quite a lot. I understand your point about Windows caching specific often-used files, but can you point to any real benchmarking data or some other source to back up your claim that Windows will do a better job? You certainly may be right, but that claim strikes me as being very case-specific, and I'm skeptical that Windows would cache an 8 GB TC container. –  David Englund May 30 '13 at 18:28
Regarding stability, your point is well-taken. However, most RAM disk tools periodically write to the disk -- not just at shutdown or when dismounted -- so that can reduce the risk somewhat. Again, yours is a general complaint about RAM disks; it sounds like TC wouldn't be an exceptional case in that respect. (Hopefully I'm understanding that correctly.) –  David Englund May 30 '13 at 18:30
You're correct in that it won't cache the entire TC container - but that's because you're never actually using the entire TC container. If you want to feel the difference, boot up your system and use it normally for several days. Feel how fast it is. Then, shut down the system and put only 1GB of memory or even 512MB of memory in it and reboot the system. Performance will be absolutely terrible. –  Darth Android May 30 '13 at 21:13
Benchmarks are useless for this because they show artificial use cases, and disk caches are best at real-world use cases, like situations where you only need to cache part of a file (which is almost all the time). RAM disks "feel" faster because you can forcibly preload specific content into them. That only applies to the first time you open something, however. The second, third, fourth, and n th times you read from a file? There's no difference between a disk cache and a RAM disk, except that you can fit more useful data into a disk cache. –  Darth Android May 30 '13 at 21:20

As Darth explained, using a ram disk in general is normally not a good idea, but more importantly, encrypting one is utterly pointless because the purpose of encrypting a drive is to protect its contents while the system is off, and a ramdisk no longer exists when the system is off.

share|improve this answer
I agree that using a RAM disk in general is not a good idea. However, if one is used and if security is paramount, your suggestion of leaving it unencrypted makes no sense whatsoever. Cold boot attacks are very much a reality. –  Karan May 31 '13 at 2:02
@Karan, the article you linked is about compromising the encryption key of a computer that is on, and so is a further reason why encrypting a ramdisk does no good. –  psusi May 31 '13 at 13:35
It mentions how different RAM chips have varying data retention rates even after the computer is turned off, and how this duration can be enhanced by actually cooling the RAM. If the RAMdisk data is accessed even after the PC has been switched off (unlike what you said), wouldn't it obviously be better from a security standpoint to have it encrypted? If the encryption key is retrieved of course then nothing can be done, but that's no reason to not recommend encryption altogether. –  Karan May 31 '13 at 17:49
@Karan, the attack involves taking a running computer and yanking the power, not one that has been shut down properly. And no, it isn't any better to have it encrypted since if you can recover the ram, you can recover the key with it. The purpose of encrypting a drive is to make sure that when you shut the system down ( and the key is removed from ram ), the disk can no longer be accessed by someone that compromises the system. If the system is compromised while it is on and the disk mounted, well, it's already unlocked. In other words, a lock that is unlocked doesn't protect anything. –  psusi May 31 '13 at 18:13
I think the reference to the cold boot attack took away attention from what I was trying to highlight, that RAM can retain data even after a normal shutdown (not just after a sudden loss of power), when the encryption key would normally have been wiped by TC. Seems to me in this case if data is encrypted it would obviously be far more secure than if there was no encrytion in the first place. Anyway, I realise this sort of data acquisition is highly unlikely, but still I see no reason not to encrypt RAMdisk data if security is paramount. –  Karan May 31 '13 at 18:38
up vote 0 down vote accepted

As some have pointed out, the performance gains from RAM disks shown in benchmarks may not be greater than the performance losses from the decrease in memory available to Windows for caching. As far as we know at this point, there isn't any good data to support this (possibly because it's difficult to measure), but there seems to be agreement on the issue. Nevertheless, with respect to my question, there isn't a good reason to expect that performance of a TrueCrypt drive stored in a RAM disk would be an exceptional case in this regard. If RAM disks are faster than HDD+cache for 8 GB of unencrypted files, RAM disks will probably also be faster for an 8 GB TrueCrypt container. There isn't any data to support this claim either, but the claim hasn't been challenged anyway.

Regarding stability, using RAM disk software that periodically writes the data to the disk helps boost stability, but it only partially resolves the instability issue. Combining this instability with the risk of data lost due to encryption (which is always a risk, however small), using a TrueCrypt container in a RAM disk does present an additional stability risk. How much, exactly? We're not sure.

With respect to security, this may warrant further investigation from an expert (perhaps a post on security.SE) to determine if there are additional risks. However, as @Karen pointed out, the encrypted drive is still more safe than an unencrypted one, even if @psusi is right about the difference being minimal.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.