How to create a in-memory RAM disk on my Linux VM instance that's on google cloud?

0 votes
Sep 25 in GCP by Sam
• 4,330 points
49 views

1 answer to this question.

0 votes

You can create a RAM disk with the tmpfs tool, which is installed by default on many Linux Operating Systems.

  1. your instance does not have enough available memory, you can optionally change the instance machine type to a machine type with more memory.

  2. Connect to your instance through SSH. For this example, go to the VM instances page and click the SSH button next the instance where you want to add a RAM disk.

  3. Create a mount point for your RAM disk.

    $ sudo mkdir /mnt/ram-disk
  4. Create and mount a new tmpfs RAM disk. You must determine a value for the size property that meets your storage requirements without competing with your applications for memory or expending all of the available memory. For this example, the instance has a n1-highmem-32 machine type with 208 GB of memory, so a 50g RAM disk size is appropriate.

    $sudo mount -t tmpfs -o size=50g tmpfs /mnt/ram-disk
  5. Add the RAM disk to the /etc/fstab file so that the device automatically mounts again if you restart the instance:

    $echo 'tmpfs /mnt/ram-disk tmpfs nodev,nosuid,noexec,nodiratime,size=50G 0 0' | sudo tee -a /etc/fstab
answered Sep 25 by Sirajul
• 41,000 points

Related Questions In GCP

0 votes
1 answer
0 votes
1 answer

How do i delete a RAM disk from my instance on GCP?

You can unmount a tmpfs RAM disk just like ...READ MORE

answered Oct 22 in GCP by Sirajul
• 41,000 points
32 views
0 votes
1 answer

How to create a Google Cloud Filestore instance?

Create an instance by running the instances create command, ...READ MORE

answered Oct 23 in GCP by Sirajul
• 41,000 points
32 views
0 votes
1 answer
0 votes
1 answer

Create a Windows VM instance using Google Compute Engine (GCE).

To create a Windows virtual machine instance ...READ MORE

answered Sep 20 in GCP by Sirajul
• 41,000 points
118 views
0 votes
1 answer

Creating a SQL Server instance using Google Compute engine.

Google Compute Engine provides public images preconfigured with ...READ MORE

answered Sep 23 in GCP by Sirajul
• 41,000 points
65 views
0 votes
1 answer