<p>I'm using k8s on google cloud and I'm trying to use google cloud's build-in snapshotting for backups, but I would also like to use them for retrieving a db to work with locally. I've come to the conclusion that I need to first create an image of the snapshot, then export that image to a bucket before downloading. Something like this:</p>

<pre><code>
    gcloud compute disks snapshot mydrive --snapshot-names=mydrive-snapshot
    gcloud compute images create mydrive-image --source-snapshot mydrive-snapshot
    gcloud compute images export --destination-uri gs://my-bucket/mydrive-image.tar.gz --image mydrive-image 
    gsutil cp gs://my-bucket/my-drive-image.tar.gz file://my-drive-image.tar.gz
    tar xvf my-drive-image.tar.gz
</code></pre>

<p>This gives me a file <code>disk.raw</code>. Not sure how to mount this locally though?</p>

<p>Are there any other simple solutions to this? I would be fine to use a native k8s workflow instead as long as its on the volume level and doesn't involve actually running anything in a pod.</p>

<p>Why not just mount the GCS bucket locally in which you exported the disk data?</p>

<p>You can use <a href="https://cloud.google.com/storage/docs/gcs-fuse" rel="nofollow noreferrer">gcsfuse</a> for doing this.</p>

<ol>
<li>Follow these <a href="https://github.com/GoogleCloudPlatform/gcsfuse/blob/master/docs/installing.md" rel="nofollow noreferrer">instructions</a> for installing Cloud Storage FUSE and its dependencies</li>
<li>Set up credentials for Cloud Storage FUSE (follow the above instructions to do this)</li>
<li>Create a directory (or use an already existing directory to mount the bucket)</li>
<li>Use Cloud Storage FUSE to mount the bucket (e.g. <code>my-bucket</code>).

<pre><code>gcsfuse my-bucket /path/to/mount
</code></pre></li>
<li>Now you can see the content inside the bucket:

<pre><code>ls /path/to/mount
</code></pre></li>
</ol>
