Managing Snapshots

A snapshot is a copy of the machine image boot disk taken at a specific time from an instance that is in running or shutdown state. You can add this copy to image lists, and use it to create a new instance.

Instance modifications are not preserved when an instance is deleted as a result of stopping an orchestration. Deleting an instance also removes all customizations and changes made to the boot disk since its creation. To keep the customized virtual machine (VM), create a snapshot to preserve the machine image. Then use the snapshot to create new VMs with the same customizations.

Note:

Another way to preserve customizations is to shut down that instance to free CPU and memory resources. When the VM is restarted, its customizations remain in effect. For more information about shutting down VM, see shutdown instance.

add snapshot

This command enables you to add a new snapshot for a specific instance.

Syntax

oracle-compute add snapshot instance [--name] [--machineimage] [--quota]

Parameters and Options

The following parameters are specific to this command. You can also use the common options described in General Command Options.

Parameter Description
instance Instance for which a snapshot must be taken
--name (Optional) Unique identifier of the snapshot which replaces the identifier generated by the server.

Object names can contain only alphanumeric characters, hyphens, and periods. Object names are case-sensitive.

--quota (Optional) Quota against which this snapshot will be stored
--machineimage (Optional) Unique identifier of the machine image. If you do not provide this option, then the unique identifier is generated by the server.

Example

$ oracle-compute add snapshot /mytenant/public/190f166c-a08d-4f33-8c21-7291bcce98fc --machineimage /mytenant/public/snapshot-1

Sample Output

$ oracle-compute add snapshot /mytenant/public/190f166c-a08d-4f33-8c21-7291bcce98fc --machineimage /mytenant/public/snapshot-1 -Fname,state
name                                                                                        state
/mytenant/public/190f166c-a08d-4f33-8c21-7291bcce98fc/a0d58bae-687e-4c6f-9a77-5f6092f58590  active 

delete snapshot

This command enables you to delete a snapshot creation request. This deletes only the request; the machine image that was the result of the request is not removed.

The following restrictions apply for deleting a snapshot request:
  • Requests in the active state cannot be deleted.

  • Requests can only be deleted when they are in the error or complete state.

Syntax

oracle-compute delete snapshot name

Parameters and Options

The following parameters are specific to this command. You can also use the common options described in General Command Options.

Parameter Description
name Snapshot unique identifier

Example

$ oracle-compute delete snapshot /mytenant/public/a6fbb572-a584-486a-9314-56a24499028d/4dbb2b4c-d315-47ba-b938-696f74826bec

Retrieve Snapshot Details

You can retrieve the snapshot details by using the CLI.

discover snapshot

This command enables you to discover snapshots in a specific container.

Syntax

oracle-compute discover snapshot container

Parameters and Options

The following parameters are specific to this command. You can also use the common options described in General Command Options.

Parameter Description
container Hierarchical name-space for snapshots

Example

$ oracle-compute discover snapshot /mytenant/public/a6fbb572-a584-486a-9314-56a24499028d/

Sample Output

$ oracle-compute discover snapshot /mytenant/public/a6fbb572-a584-486a-9314-56a24499028d/
entry
/mytenant/public/a6fbb572-a584-486a-9314-56a24499028d/4dbb2b4c-d315-47ba-b938-696f74826bec
/mytenant/public/a6fbb572-a584-486a-9314-56a24499028d/df8caca5-8a27-4153-9c5f-7440080b40c8

get snapshot

This command enables you to retrieve details for a specific snapshot.

Syntax

oracle-compute get snapshot name

Parameters and Options

The following parameters are specific to this command. You can also use the common options described in General Command Options.

Parameter Description
name Snapshot unique identifier generated by the server

Example

$ oracle-compute get snapshot /mytenant/public/a6fbb572-a584-486a-9314-56a24499028d/4dbb2b4c-d315-47ba-b938-696f74826bec -f json

Sample Output

 $ oracle-compute get snapshot /mytenant/public/a6fbb572-a584-486a-9314-56a24499028d/4dbb2b4c-d315-47ba-b938-696f74826bec -fjson
{
 "list": [
  {
   "name": "/mytenant/public/a6fbb572-a584-486a-9314-56a24499028d/4dbb2b4c-d315-47ba-b938-696f74826bec",
   "machineimage": "/mytenant/public/snapshot1",
   "uri": "https://api.oc.example.com/snapshot/mytenant/public/a6fbb572-a584-486a-9314-56a24499028d/4dbb2b4c-d315-47ba-b938-696f74826bec",
   "quota": null,
   "instance": "/mytenant/public/a6fbb572-a584-486a-9314-56a24499028d",
   "state": "active",
   "error_reason": ""
  }
 ]
}

list snapshot

This command enables you to list information for snapshots in a specific container.

Syntax

oracle-compute list snapshot container [--name] [--quota] [--instance] [--machineimage]

Parameters and Options

The following parameters are specific to this command. You can also use the common options described in General Command Options.

Note:

The output of this command is filtered based on the optional parameters (if specified).
Parameter Description
container Hierarchical namespace for snapshots
--name (Optional) ) Unique identifier of the Snapshot which replaces the identifier generated by the server
--quota (Optional) Quota against which this snapshot will be stored
--instance (Optional) Instance for which the snapshot was taken
--machineimage (Optional) Unique identifier of the machine image

Example

$ oracle-compute list snapshot /mytenant/

Sample Output

$ oracle-compute list snapshot /mytenant/ -Fname,machineimage
name                                                            machineimage
/mytenant/public/a6fbb572-48....7ba-b938-696f74826bec   /mytenant/it/lucid64
/mytenant/public/a6fbb...-8a27-4153-9c5f-7440080b40c8   /mytenant/public/a6fbb572-a5....7440080b40c8