Question

Difficulty: HardManaging Compute Engine Resources

A system administrator needs to recover a Compute Engine VM instance whose primary boot disk has suffered operating system corruption. The administrator has access to a recent, uncorrupted disk snapshot. What is the correct sequence of steps to restore the instance to operational status using the gcloud CLI while preserving the VM instance identity and IP configurations?

  1. 1Stop the affected Compute Engine VM instance using gcloud compute instances stop.
  2. 2Create a new persistent disk from the snapshot using gcloud compute disks create with the --source-snapshot flag.
  3. 3Detach the corrupted boot disk from the VM instance using gcloud compute instances detach-disk.
  4. 4Attach the restored persistent disk to the VM instance using gcloud compute instances attach-disk with the --boot flag.
  5. 5Start the Compute Engine VM instance using gcloud compute instances start.

Answer

The correct operational sequence requires stopping the instance, creating a persistent disk from the snapshot, detaching the corrupted boot disk, attaching the newly created disk with the --boot flag, and finally starting the instance.
To successfully replace a corrupted boot disk on an existing Compute Engine VM instance, the instance must first be stopped to allow disk modification. Next, a persistent disk must be instantiated from the snapshot because snapshots cannot be mounted directly. The corrupted disk is then detached, the restored disk is attached with the --boot flag, and the instance is started.

Step-by-Step Solution

1
Stop the affected Compute Engine VM instance.
The instance state transitions to TERMINATED.
Compute Engine requires the instance to be stopped before modifying or detaching its root boot disk.
2
Provision a new persistent disk from the snapshot.
A new persistent disk is populated with data from the target snapshot.
Snapshots cannot be attached directly to instances; they must first be converted into a Persistent Disk resource.
3
Detach the corrupted persistent boot disk.
The corrupted disk is disassociated from the VM instance.
A VM instance can only have one primary boot disk attached at any given time.
4
Attach the new persistent disk as the boot disk.
The new persistent disk becomes the designated boot disk for the VM.
Specifying the --boot flag tells Compute Engine to configure BIOS/UEFI boot properties for this attached disk.
5
Start the Compute Engine VM instance.
The VM boots successfully into the restored operating system state.
Powering on the VM initiates the boot sequence using the newly attached boot disk.

Key Concept

Compute Engine Boot Disk Recovery and Lifecycle Management
Rate this question