I'm in an odd situation where I have plenty of RAM sitting around (200gb extra) and ALMOST enough SSD to do a read/write intensive process. Is there any way to say "Dear System, please create a temp virtual drive that is a combination of the RAM and SSD, so that for some of the read/write operations that are backed by the SSD they go kinda-fast, and others backed by the RAM go REALLY fast"?
Well, yes, but actually no.
While it is possible to create a virtual disk in RAM, it's not handled the same way other disks are. In particular, it doesn't have a device node in
/dev, so it isn't visible to features like "LVM" or "mdadm" (which could otherwise be used to join two different disks into one big virtual disk).
There is a way to kinda-sorta do what you're asking, and that's to turn your SSD into swap space, then create a big RAM disk. However, because it's a RAM disk, you won't be able to read directly from the SSD. Each block will be automatically copied into RAM when your program tries to access it, and depending on the exact nature of the process you're running, I think it's highly likely that thrashing will destroy the performance gains you hope to achieve.
If you're bound and determined to go through with this, here are the steps. (Note 1: I'm assuming your SSD is
/dev/sdb. Replace this with the actual designation of your SSD drive. Note 2: This will erase your SSD. Make sure you have a copy of any important data before you begin. Note 3: You're going to be using root privileges while playing with tools that could potentially wipe your system, so be really careful, and stop immediately if anything seems even the slightest bit off.)
- Format your SSD for swap:
sudo mkswap /dev/sdb.
- (Optional, but recommended) Use
swapon -sto get a list of any swap areas that are currently active, and use
sudo swapoff [device]to turn them off.
- Activate the SSD swap:
sudo swapon /dev/sdb.
- Create a directory to mount your RAM disk:
- Create and mount the actual RAM disk:
sudo mount -t tmpfs -o size=[size] myramdisk /tmp/ramdisk(You must use
tmpfsfor this, since
ramfsdoesn't use swap.)
And that's it. Now, anything you write to
/tmp/ramdisk will be stored in RAM, and anything that's too big for RAM will be swapped out to your SSD. When you're done, everything you did (except formatting your SSD) will be undone by a simple reboot.