I would like to know how I can migrate a Persistence Disk (Google Compute Engine) from one project to another? If it's posible.
Migrate a zonal persistent disk to a regional persistent disk. To convert your existing zonal persistent disk to a regional persistent disk, create a new regional disk by cloning an existing zonal disk. For more information, see Creating a regional disk clone from a zonal disk.
From Google's documentation: It is possible to attach a persistent disk to more than one instance. However, if you attach a persistent disk to multiple instances, all instances must attach the persistent disk in read-only mode. It is not possible to attach the persistent disk to multiple instances in read-write mode.
Each Migrate for Compute Engine Edge deployment incorporates active-active appliances deployed across two zones. Writes are acknowledged in both zones and asynchronously transferred back to on-prem storage to prevent data loss in the event of an outage.
If you want to copy (non-root) persistent disk, do the steps below:
<disk-name>
disk from the machine.gcloud
command-line utility to switch to the old project:
gcloud config set project <old-project>
<disk-name>
disk:
gcloud compute images create <image-name> --source-disk=<disk-name> --source-disk-zone=<zone>
https://www.googleapis.com/compute/v1/projects/<project-name>/global/images/<image-name>
). Alternatively, run:
gcloud compute images list --no-standard-images --uri | grep <image-name>
to find the link.gcloud config set project <new-project>
gcloud compute disks create <new-disk-name> --image=<link-to-the-image> --zone=<zone>
As above Mike Lutz's answer, except gcutil
is now deprecated, but the 2nd command can also be done with gcloud compute instance
are:
1) create your image from you PD (NB! read first! https://cloud.google.com/compute/docs/images#creating_an_image_from_a_root_persistent_disk)
$ gcloud compute images create [example-image] --source-disk [example-disk] --source-disk-zone ZONE --project="old-project-name"
2) Instantiate the image in the new project (goes without saying but you must have access to both projects)
$ gcloud compute instances create [example-instance-1] --project=[new-project-name] --image="https://www.googleapis.com/compute/v1/projects/[old-project-name]/global/images/[image-name]" --boot-disk-size [XXXGB] --machine-type=[machine-type] --network="default" --zone=[datacenter-zone]
For additional instance config options see: https://cloud.google.com/sdk/gcloud/reference/compute/instances/create
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With