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

0 votes
Sep 25, 2019 in GCP by Sam
• 6,260 points
1,413 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

Hope it helps!!

To know more about Google Cloud, join Google Cloud platform certification course today.

Thank You!

answered Sep 25, 2019 by Sirajul
• 59,230 points

Related Questions In GCP

0 votes
1 answer

How to add a regional persistent disk to a VM instance on GCP?

You must first create the regional persistent ...READ MORE

answered Oct 18, 2019 in GCP by Sirajul
• 59,230 points
2,729 views
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, 2019 in GCP by Sirajul
• 59,230 points
1,026 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, 2019 in GCP by Sirajul
• 59,230 points
1,714 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, 2019 in GCP by Sirajul
• 59,230 points
4,711 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, 2019 in GCP by Sirajul
• 59,230 points
2,896 views
0 votes
1 answer
0 votes
1 answer

How to add a PTR record to my VM instance on gcp?

If your VM instance uses the primary ...READ MORE

answered Sep 26, 2019 in GCP by Sirajul
• 59,230 points
1,849 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP