1

Under Ubuntu, how much performance gain will the RAM disk provide over the normal nvme m.2 SSD? Could you please let us know what is the effective size of extra RAM to get to make RAM disk's performance optimal? Is 32GB a good amount? How do I create and remove RAM disk? Thanks.

1 Answers1

0

RAM disks will not make up for losses due to Meltdown/Spectre patching. Those patches do not affect read speed, they instead affect how the processor executes code - there will be no difference from using a ramdisk.

That said, a ramdisk is a very good way of speeding up access to certain important files, often at significant gains over NVMe drives. This affects file load times, and everything dependent on loading files.

Your ramdisk size depends very heavily on what your usecase is, and what you're trying to do. Most programs will load their required resources into RAM anyways, meaning you're likely to not see any gain in already running programs (usually). For example, a ramdisk won't make browsing the Internet any faster. A good idea to determine a ramdisk size is to look at files you use and open very regularly, and then get the total size of that. Double it, and that's your ramdisk size.

Creating the ramdisk is just a couple of simple commands. Assuming you want a 4 GB ramdisk, simply run (as root):

mkdir -p /media/ramdisk
mount -t tmpfs -o size=4096M tmpfs /media/ramdisk

Once created, you can copy your often-accessed files into RAM. If you want to make a persistent ramdisk (that is, a disk that's auto-created at boot), see the above linked thread.

Note that your ramdisk will not persist data through reboots, nor will changes made to files in your ramdisk get written back to your real disk. Both initially loading data to your ramdisk on every boot and saving files off it is completely your responsibility, though you can write scripts/utilities to help you with this.

Kaz Wolfe
  • 34,680