Ram as Disk For cache

      No Comments on Ram as Disk For cache

Here’s a comparison of read/write speeds for different storage types: HDD, SSD, NVMe SSD, and RAM Disk:

Storage Type Read Speed (MB/s) Write Speed (MB/s) Latency (ms) IOPS
HDD 80–200 80–200 10–15 50–200
SATA SSD 450–560 450–560 0.1 10,000–90,000
NVMe SSD 2,000–7,000 2,000–7,000 0.02–0.1 500,000–1,000,000
RAM Disk 10,000–50,000 10,000–50,000 0.001 Millions
  • HDD: Suitable for archival storage and bulk data with low performance needs.
  • SATA SSD: Great for general-purpose use with much better performance than HDDs.
  • NVMe SSD: Ideal for high-performance applications, large data processing, and gaming.
  • RAM Disk: Ultra-fast temporary storage, perfect for caching and real-time high-speed operations, but volatile and expensive.

To mount a 30GB RAM disk at /ram, follow these steps:
1. Create the Mount Director

sudo mkdir /ram

2. Mount the RAM Disk

sudo mount -t tmpfs -o size=30G tmpfs /ram

3. Verify the RAM Disk

df -h | grep ram

You should see something like this:

tmpfs 30G 0 30G 0% /ram

4. Make the RAM Disk Persistent

Open /etc/fstab for editing: (before do anything backup the file)

sudo nano /etc/fstab

Add the following line at the end:

tmpfs /ram tmpfs size=30G 0 0

Test the configuration:

sudo mount -a

6. Remove the RAM Disk (If Needed)

sudo umount /ram

Delete the directory:

sudo rmdir /ram

Remember: Data is lost on power-off or reboot.

Leave a Reply

Your email address will not be published. Required fields are marked *