Ani
Ani

Reputation: 1457

Can I use Cloud Shell with more than the 5 GB persistent storage?

According to the docs:

Cloud Shell provisions 5 GB of free persistent disk storage mounted as your $HOME directory on the virtual machine instance.

I would need more (paid) storage though that I can access from the Cloud Shell environment and that is persistent across my sessions. It's mostly used to store local clones of git repositories and images. I would be the only one to access these files.

It seems that the 5 GB storage is a hard limit, so it won't expand dynamically and bill me for the exceeding amount. It is possible to use Boost Mode, but that does not affect the storage size. And I also can't provision more storage with a custom Cloud Shell environment. I couldn't figure out if I can mount another GCE persistent disk to my $HOME. I was considering gcs-fuse as suggested in this answer but I'm not sure if it is suitable for git repos.

Is there any way to have more storage available in Cloud Shell?

Upvotes: 7

Views: 4852

Answers (4)

mze3e
mze3e

Reputation: 568

There is another way to have more disk space in the cloud shell. It's to create a cloud storage bucket and map the cloud storage bucket as a folder. This way you can store larger files in the cloud storage bucket and it doesn't require any compute instance.

  1. Go to cloud storage and create a new storage bucket

  2. Copy the storage bucket's name, eg. my_storage_bucket

  3. Go to cloud shell and create a folder in your home folder

    mkdir ~/my_bucket_folder

  4. Mount the storage bucket to this folder

    gcsfuse my_storage_bucket ~/my_bucket_folder

  5. Change directory to your my_bucket_folder

    cd ~/my_bucket_folder

  6. Voila! you have unlimited space!

  7. To unmount please run the following

    fusermount -u ~/my_bucket_folder

Upvotes: 9

robertsahlin
robertsahlin

Reputation: 541

I'm using gcsfuse and works fine. You don't have to remount every time if you put the mount command in .customize_environment (run on boot up).

#!/bin/sh
#.customize_environmnet run in background as root, wait for your user to initialize
sleep 20
sudo -u [USER] gcsfuse -o nonempty -file-mode=777 -dir-mode=777 --uid=1000 --debug_gcs [BUCKET_NAME] /home/[USER]/[FOLDER_NAME]

You can read more at Unlimited persistent disk in google cloud shell

Upvotes: 3

John Hanley
John Hanley

Reputation: 81414

Google Cloud Shell is a container that runs on a hidden Compute Engine instance managed by Google. You can download, modify and redeploy this container to Cloud Shell or to your own container running in the cloud or on your desktop.

The base image of the container is available at gcr.io/cloudshell-images/cloudshell:latest, per this page.

For your use case, I would use Compute Engine with Container OS and run the Cloud Shell container within COS. You can scale the CPUs, memory, and storage to fit your requirements.

You can also set up a Compute Engine instance, install the CLIs, SDKs, and tools and have a more powerful system.

Notes for future readers based upon the first answer:

  1. Filestore is a great product, but pay attention to costs. The minimum deployment is 1 TB at $200+ per month. You will need to mount the NFS share each time Cloud Shell restarts - this can be put into login scripts. Note: I am not sure if you can actually mount an NFS share from Filestore in Cloud Shell. I have never tested this.
  2. You will have the same remount problem with FUSE, plus you will have bandwidth costs to access Cloud Storage.
  3. Cloud Shell is a great product that is well implemented, but when you need to exceed its capabilities it is better to deploy a small/medium size GCE instance. this enables persistent, snapshots, etc.

Upvotes: 7

maniSidhu98
maniSidhu98

Reputation: 537

There is no way of adding more storage to the Cloud Shell. You can create a VM and install the Cloud SDK and have as much storage as you'd like but it is not currently possible to add storage space to the Cloud Shell.

Depending on how you plan on using the saved repos, Cloud Storage may be ideal as it has a storage category just perfect archiving.

Filestore will be your best option as it is great for file systems and it is scalable. It fits your needs as you have described.

You can use Cloud Storage with FUSE. Keep in mind that this method, although great, depends on how it will be used as costs are based on storage category.

You can see a brief comparison of the Storage solutions the Cloud Platform has to offer here.

Upvotes: 2

Related Questions