I've got some code that processes a load of data stored on an external HDD. There is about 6.5 GiB of data on the disk, but only a few files are processed rather than the entire contents.

I created a ramdisk using a tmpfs filesystem to store a copy of the disk contents in memory to speed up the processing time required. Every time I reboot my system, I have to copy the contents of the disk back into this ramdisk.

This works ok, because the entire contents can fit into the amount of available memory that I have.

However it may not work later on when I change to a different, larger dataset.

This is quite inefficient, because the amount of data that I actually read is only about 1 GB. (A bit over 10 % in my estimates.)

Is there a way to create a ramdisk in memory which caches data read from this external disk?

I'm sure such a thing must be possible with linux - but I don't know what to search for. Ramdisks are already quite a niche topic.

Btw I'm using Debian Testing, which at the time of writing is the testing branch ahead of Debian 10.

Edit: I do not write back to this disk, if it makes any difference.