Skip to Content

How to dump and restore disks across projects

Posted on One min read

Sometimes you need to migrate a particular system from one cloud project to another. For example, migrating a Kafka setup, or a Nexus repository, to a different project, regardless of whether you use a local or persistent disk.

How can you achieve that? By dumping a disk and restoring it in another project. And by using custom images. Let’s see how.


First of all, you’ll need to have the gcloud CLI SDK installed and configured.

Creating a custom image

First, let’s dump the local disk as a custom image:

gcloud compute images create data_dump \
    --project=<project_a> \
    --source-disk=source-disk-name \
    --source-disk-zone us-central1-b \

Note: --force can be used for disk attached to a running instance, be aware of this, as it is not recommended to create a custom image from a disk in active use.

List the custom images of project_a

gcloud compute images list \
    --no-standard-images \

Create disk in the new project project_b

gcloud compute disks create data_disk \
    --image=projects/<project_a>/global/images/data_dump \

Now it is ready to snapshot data_disk or attach data_disk to any running instances in project_b!

comments powered by Disqus