Compute Engine: Restore Disks in Place
Who can use this feature
Anyone with these permissions: Restore resources
Restoring the disks of an existing Compute Engine instance in place returns it to the state of an Eon snapshot without creating a new instance. The instance keeps its ID, network interfaces, private IP addresses, and configuration.
This article explains how to restore the disks of a Compute Engine instance in place from the Eon console.
To restore into a new instance instead, see Compute Engine: Restore a VM. To restore a single disk as a new disk, see Compute Engine: Restore a Disk.
Restore the disks of an instance
You can start from the inventory page in the Eon console.
Eon stops the instance while it swaps the disks, which interrupts anything running on it.
Before you start
Before you restore the disks of an instance in place, make sure:
-
The restore project is the GCP project that contains the instance. Its permissions version is 1.8.0 or later, which adds
compute.instances.starton every instance in the project. Earlier versions can start only instances that Eon named or tagged. -
A restore account has been connected to your Eon account.
-
The GCP restore project has a VPC and subnet that meet restore server connectivity requirements. By default, Eon uses the default VPC and subnet, but you can customize the restore server connectivity if needed.
-
The instance is running or stopped, and no managed instance group manages it. A suspended instance stays in that state until you resume it, so resume it first.
-
If the instance runs as a service account, the restore account can act as that service account. The restore account gets this access through the Service Account User role (
roles/iam.serviceAccountUser). Connecting a restore project doesn’t grant it, so grant it on each service account that an instance you restore runs as. For instructions, see Let the restore account act as a service account. An instance without a service account needs nothing.
Find the snapshot you want to restore
-
In your inventory, select the Compute Engine instance whose disks you want to restore. The resource details panel opens.
-
Click the Eon snapshots tab. You’ll see a calendar view with colored dots on the days when snapshots were taken. There can be more than one snapshot per day.
When you click a day, a list of Eon snapshots taken that day is displayed below the calendar.
-
Expand the snapshot you want to restore. Under What do you want to restore?, select Restore disks in place, and then click Restore. The Restore disks in place wizard opens.
Choose the disks to restore
In the Disks step, Eon chooses the restore account and runs a plan check on the live instance. The read-only Restore account block shows the name of the restore account Eon uses. The plan check lists each disk of the snapshot in a table.
-
Review the plan check results. If This VM’s disks can’t be restored in place appears, the instance has a blocker. If a disk can’t be restored, it’s listed with the reason and can’t be selected. For what each result means, see Plan check results.
-
Clear the disks you don’t want to restore. Eon selects every disk that can be restored.
-
Click Next.
Disks that were added to the instance after the snapshot was taken appear under Stays attached. Eon doesn’t touch them.
Review and start the restore
In the Review step, Eon summarizes how many of the snapshot’s disks it restores into the instance, and shows the Restore account block again.
-
Select the checkbox for each warning under Acknowledge before you continue. The warnings that appear depend on the instance and your selection.
-
To choose whether the instance is running after the restore, turn Start instance after restore on or off. If you don’t change the switch, Eon starts the instance after the swap only when the instance was running just before Eon stopped it.
-
Click Restore disks. Eon starts the asynchronous restore job.
If the instance’s disks change while you review them, or Eon would now choose a different restore account, Eon asks you to review the changes or plan the restore again before you can restore.
You can monitor the restore job on the Restore jobs tab in the Jobs page. The job type is GCE in-place disk restore.
When the restore job succeeds, the restored disks are in the same slots as the disks they replaced. The instance is running only if Eon started it.
Plan check results
The plan check reads the instance live, so the result reflects its disks at the moment you open the wizard. The wizard words each blocker and warning slightly differently from the descriptions below.
Restore account
You don’t choose the restore account. Eon considers the restore projects connected for the GCP project that contains the instance. Of these, it keeps the active ones in the project that your role allows as a restore destination. Eon swaps the disks with the one that passes every check.
When no restore account passes every check, the plan check lists the blockers of the restore account closest to working, together, under This VM’s disks can’t be restored in place. When your role allows none of the restore accounts, the plan check fails with You can’t restore this VM’s disks in place: permission denied: restore account access restricted by role. Ask an administrator to change your role’s restore destination limits.
Instance blockers
A blocker at this level disables the restore for every disk.
Disk blockers
A disk blocker disables only the affected disk. The wizard lists it with the disk’s ID and the reason it can’t be restored, and you can restore the instance’s other disks.
Warnings to acknowledge
A warning doesn’t block the restore. You acknowledge each warning that applies on the Review step before you can start.
What happens during the restore
Eon restores the data first, so the instance is unavailable only while Eon swaps the disks:
-
Eon restores each selected disk from the snapshot into a new disk while the instance keeps running.
-
Eon skips the scheduled backups and scans of the instance that haven’t started yet. They appear as Skipped in the job list. If a backup of the instance has already started, Eon waits until it has captured the disks, which usually takes a few minutes.
-
Eon checks the instance’s disks again. If they changed since you reviewed them, the restore fails before it stops the instance.
-
Eon stops the instance, detaches the selected disks, and attaches the restored disks in the same slots.
-
Eon starts the instance if you chose to, or if you left the switch unchanged and the instance was running before the stop.
Disks that you didn’t select stay attached and aren’t changed.
Backups and scans after the restore
For one hour after the restore, Eon holds the scheduled backups and scans of the instance. When the hour ends, a held scheduled backup runs if its schedule window is still open. If the window has closed, the backup appears as Skipped.
On-demand backups aren’t held. Starting an on-demand backup of the instance ends the hold early.
What happens to the original disks
Eon keeps each original disk, detached and marked with the job ID, and never deletes it.
The originals stay in your account and incur cost until you delete them.
Eon labels each detached original disk with eon-in-place-restore-job-id, eon-in-place-restore-instance, and eon-in-place-restore-device.
The restore job’s details list each swap under Disk swap: the Slot, the Original disk (kept), and the Restored disk. The state next to the instance’s ID is Swapped after a successful restore. While the swap runs it shows Swap in progress. If a job ends while it still shows that state, check which disks are attached to the instance.
There’s no way to revert a restore in Eon. To go back to an original disk, stop the instance, detach the restored disk from the slot that Disk swap lists, and attach the original there.
If the restore fails
What Eon does depends on how far the restore got:
-
Before Eon stops the instance: The instance isn’t changed, and Eon deletes the disks it restored.
-
After the stop, before the swap: Eon starts the instance if it was running before, and deletes the disks it restored.
-
During the swap: Eon puts the original disks back in their slots, starts the instance if it was running before, and deletes the disks it restored. The job’s Disk swap state is Original disks put back.
-
If Eon can’t put the original disks back: The state is Putting the originals back failed, and Eon deletes nothing. The original disks and the restored disks are both kept, so you can attach the ones you want. The instance stays stopped.
-
If the instance doesn’t start again after Eon puts the original disks back: The job fails and the instance stays stopped. Eon still deletes the restored disks. Start the instance yourself.
-
If the instance doesn’t start after a successful swap: The job fails and the instance keeps the restored disks. Start the instance yourself, or stop it, detach the restored disks, and attach the original disks.
If Compute Engine refuses to attach disks during the swap because the restore account can’t act as the instance’s service account, the job error names that service account. To get the instance running with its original disks:
-
Grant the restore account access, as described in Let the restore account act as a service account.
-
Attach each original disk in the slot that Disk swap lists for it.
-
Start the instance.
Let the restore account act as a service account
Compute Engine requires the restore account to act as an instance’s service account whenever it attaches a disk to that instance. Without this access, the job fails before it stops the instance, with an error that names the service account and the role.
To grant the access, you need permission to manage access to the instance’s service account, for example the Service Account Admin role.
The Service Account User role lets the restore account act as, or impersonate, the service account. Grant it on that service account only, not on the project.
For details, see Google’s Service account impersonation and Manage access to service accounts.
You need two emails: the instance’s service account, and the restore account’s service account. Then grant the role in the Google Cloud console or with gcloud.
Find the instance’s service account
In the Google Cloud console, the instance’s details page shows its service account under API and identity management. For more about it, see Google’s Change the service account of an instance.
Or run the following command, which prints the service account’s email:
Find the restore account’s service account
In the Google Cloud console, go to IAM & Admin → Service Accounts, and select the project that contains the instance. The restore account’s service account has this email:
In the list, it’s the email that starts with eon-restore- and doesn’t have nd right before the @.
The one with nd is another Eon service account.
Grant access in the Google Cloud console
-
Go to IAM & Admin → Service Accounts, and select the project that contains the instance’s service account.
-
Click the email of the instance’s service account, and then click the Permissions tab.
-
Click Grant access.
-
Enter the email of the restore account’s service account as the principal.
-
Click Select a role, choose Service Account User, and then click Save.
Then run the plan check again.
Grant access with gcloud
Run the following command, with the instance’s service account as <instance_service_account_email>, the restore account’s service account as <restore_service_account_email>, and the project that contains the instance’s service account as <project_id>:
Then run the plan check again.