Copying Linux VM to Different Project and Region

PCA By islever Editorial Last updated

Short answer

D Create a snapshot, convert to an image file in Cloud Storage, and use that image to create a new instance in the target project.

Question

You want to make a copy of a production Linux virtual machine in the US-Central region. You want to manage and replace the copy easily if there are changes on
the production virtual machine. You will deploy the copy as a new instance in a different project in the US-East region.
What steps must you take?
  1. Use the Linux dd and netcat commands to copy and stream the root disk contents to a new virtual machine instance in the US-East region.
  2. Create a snapshot of the root disk and select the snapshot as the root disk when you create a new virtual machine instance in the US-East region.
  3. Create an image file from the root disk with Linux dd command, create a new virtual machine instance in the US-East region
  4. Create a snapshot of the root disk, create an image file in Google Cloud Storage from the snapshot, and create a new virtual machine instance in the US-East region using the image file the root disk. Correct Answer

Key Takeaways

The question tests cross-project and cross-region VM replication, where the common trap is assuming snapshots can be directly used across projects without conversion to an image in Cloud Storage.

This page explains the correct procedure for replicating a production Linux VM to a different project and region using Google Cloud Compute Engine snapshots and images.

Common mistake: Many learners choose Option B (Create a snapshot...), mistakenly believing that global snapshots can be directly attached as root disks in another project, ignoring the need for image conversion or sharing mechanisms.

Expert Analysis

Why the Answer Is Correct

Option D is the correct answer because it outlines the standard, robust workflow for creating a portable, reusable copy of a disk across different projects and regions. Snapshots are global resources but are tightly bound to the project they were created in; you cannot simply point a new instance in a different project to a snapshot from the source project. To move data to a different project, you must create an Image. While modern GCP allows sharing snapshots via IAM, the most durable and 'easy to manage/replace' method described in traditional certification contexts involves exporting the snapshot to an image file (often stored in Cloud Storage) which can then be imported into the target project to create new instances. This aligns with the requirement to 'manage and replace the copy easily,' as images are versioned and stable.

Why the Other Options Are Wrong

Option A uses dd and netcat, which is a manual, low-level OS approach that does not leverage GCP's managed infrastructure and is prone to errors and downtime. Option B suggests using a snapshot directly in a new project; while snapshots are global, they reside in the source project's namespace and cannot be directly selected as a boot disk for an instance in a different project without first being converted to an image or shared explicitly (which isn't detailed in option B). Option C creates a local image file on the host machine using dd, which is not a GCP-native solution and doesn't address how to deploy it to a GCP instance in US-East.

Community Comment Notes

Community consensus strongly favors Option D. As user ArthurL20 noted, "Snapshots are not directly shared across projects" in the sense that you can't just select them; you need to handle the transfer. User Eroc emphasized that options A and B don't set the root disk correctly for a new VM in a different context. Several users pointed out that while snapshots are global, the cross-project constraint necessitates the image step found in D. The debate about Option B often hinges on whether one considers 'sharing' a snapshot sufficient, but D provides the explicit mechanism (image file) required for cross-project deployment in this exam's logic.

Exam Strategy

When dealing with cross-project or cross-region VM replication, always look for the 'Image' as the intermediate artifact. If the target is a different project, you generally cannot use a Snapshot directly unless you explicitly share it; however, converting to an Image is the standard pattern for creating reusable templates across boundaries.

Frequently Asked Questions

Can I use a snapshot directly from Project A in Project B?

No, snapshots are project-scoped. You must either share the snapshot via IAM permissions or convert it to an Image and import it into Project B.

Why is Option B incorrect for cross-project migration?

Option B implies using the snapshot directly. In GCP, you cannot attach a snapshot from Project A as a boot disk for an instance in Project B without first creating an Image from that snapshot.

More PCA FAQ →

Discussion 92 contributions

Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.

From public community threads 30 of 92

  1. Eroc 👍 31
    D is correct. A and B are talking about appending the file system to a new VM, not setting it at the root in a new VM set. Option C is not offered within the GCP because the image must be on the GCP platform to run the gcloud of Google Console instructions to create a VM with the image.
  2. ArthurL20 👍 16
    Only if its in the same zone: https://cloud.google.com/compute/docs/disks/create-snapshots#sharing_snapshots "Note: The disk must be in the same zone as the instance." But this is not the case here, we have: Different zones and different project hence, you must use a bucket.
  3. Sudipta 👍 16
    Why Not B. https://cloud.google.com/compute/docs/instances/create-start-instance#createsnapshot This clearly tells we can use snapshot to create a VM instance, and only need a custom image if we need to create many instances. Here we are creating only one.
  4. Jack_in_Large 👍 13
    You can't use the snapshot created by another project
  5. JasminL 👍 11
    I think the question has 2 different answers now as Google improve the snapshot function. Quoted from the link: 'You can create snapshots from disks even while they are attached to running instances. Snapshots are global resources, so you can use them to restore data to a new disk or instance within the same project. You can also share snapshots across projects.'
Show 25 more comments
  1. tartar 👍 10
    D is ok
  2. noussy 👍 8
    According to the documentation we can now https://cloud.google.com/compute/docs/disks/create-snapshots
  3. anant88 👍 5
    People are getting confused with option B and D B is not possible - Snapshots are not directly shared across projects (requirement is to put in a new project)
  4. JoeShmoe 👍 5
    B and D both work but better answer is D
  5. JJu 👍 5
    i think answer is D
  6. AWS56 👍 5
    D is fine
  7. desertlotus1211 👍 4
    However the 'real' question is asks: 'You want to manage and replace the copy easily if there are changes on the production virtual machine'. This ask supersede deploy the copy as a new instance in the US-East region...
  8. VSMu 👍 4
    B would have been the answer in the current context. But as I read carefully, it doesnt mention the step of sharing snapshot across projects. It directly expects to use the snapshot. Hence D may be the right answer!
  9. kmanb 👍 4
    I agree with Sudipta, Google recommends you create a image of a snapshot disk if you plan on creating multiple VMs. But we're not, here it says only creating one VM. So B would be the best answer
  10. romandrigo 👍 4 Answered D
    https://cloud.google.com/compute/docs/instances/copy-vm-between-projects#zonal-boot-disk
  11. AWS56 👍 4
    Agreed with D
  12. muneebarshad 👍 3
    B & D are both Correct . With Option B you can make a copy of the instance in fewer steps than Option D. (a) Create a snapshot from the instance lets say "Snapshot-1" (b) Go to "Snapshot-1" & (b) "Create instance" from the snapshot Snapshot does not have regional/Project limitation (as long as Projects are under the same ORG" ) . Why B is not the right option ?
  13. purushi 👍 3
    Copy of production Linux virtual machine in the US-Central region: - Copy = Boot disk + Local VM data ( SSD / HDD ) - Snapshot first. We cannot boot from snapshot. Need to create an image out of it. - Image - Right choice. Booting is possible + data is available in the new VM in new region
  14. clouddude 👍 3
    I am going to go with D. A and C cannot be correct because using DD in the cloud to create a boot image is not a valid pattern. B doesn't make sense because you can't boot in a new region from a snapshot in another region. D is the only answer that references the use of images.
  15. Toothpick 👍 3
    In the current state of GCP , Both B and D can be done in 3 gcloud commands each, (and both require equal amount of snapshot handling). D is better if you have more than one instance to create but in this case , they are both equally valid.
  16. Prakzz 👍 3 Answered D
    https://cloud.google.com/compute/docs/instances/copy-vm-between-projects you have to create Image from Snapshot and share it to the destination project.
  17. gauravagrawal 👍 3
    D is ok because here we are talking about setting a new VM in a different project.
  18. odacir 👍 3 Answered D
    https://cloud.google.com/compute/docs/instances/copy-vm-between-projects
  19. passnow 👍 3
    There is no argument to this, D is the correct answer
  20. viv9 👍 2
    D- Disk creation from the shared snapshot is required while using snapshot across project. Since "B" only emphasise over snapshot sharing & not over the disk creation and then attaching it to the new instance in different project so "D" seems correct. https://cloud.google.com/compute/docs/disks/create-snapshots#sharing_snapshots
  21. Svar 👍 2
    C is correct. You can create a snapshot of the root disk directly, and use it to create a new VM, as long as the new VM will be created in the same US geographical place, and this is the case becase we're going from us-central to u-east region.
  22. adoyt 👍 2
    B isn't correct because you have to create a disk first. You cannot create a VM from a snapshot directly. gcloud compute disks create DISK_NAME \ --source-snapshot SNAPSHOT_NAME \ --project SOURCE_PROJECT_ID \ --zone ZONE
  23. aGr_pX 👍 2
    It seems D is correct, according to: https://cloud.google.com/compute/docs/machine-images#when-to-use Persistent disk snapshot is not for instance cloning and replication, but custom image is expected for this action.
  24. Rathish 👍 2
    Ans: D Migrating VM to new region: Stop the instance Take a snapshot of instance Create an custom image from snapshot Create new VM Change OS Select Custom Image Choose the image created previously
  25. gcp_aws 👍 2
    Because the question talks about creating an instance in a different project, the answer is D. You must create an image. Snapshots can not be shared across projects. Correct me if I am wrong.

Reader comments & corrections

No reader corrections yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Practice All PCA Questions

Access 81 questions with complete answers and detailed explanations.

View Full PCA Practice Test →

← Back to PCA Study Guide