Destroy and data safety

sg application destroy removes the instances and volumes sg recorded as its own. Read the plan before you say yes, because volumes hold your data.

Destroy

sg application destroy --config application.yaml
Destroy 4 owned application change(s) from hello? [y/N]:

Anything in the cluster that sg can't prove it created is left alone and printed:

retained: instance scratch-box is not owned by sg
FlagDoes
--yesDestroy the prepared plan without asking
--force-volume-share <volume>Approve a same-member shared volume, the same as on deploy

What destroy keeps

RemovedKept
Owned instancesAnything sg didn't create
Owned volumes and the data on themThe application's registration (name, cluster, spec path)
Its generation history
Data-volume safety markers

There's no separate "unregister" step. The name stays bound to that spec file and cluster, so init with the same name and a different file refuses. Pick a new name for a new app.

Data-volume safety markers

The first time a volume holds service data, sg writes a permanent marker for it in the ledger: application, member, pool and volume. The marker survives taking the service out of the spec, and survives destroy.

A marker never proves the volume exists, that sg owns it, or that it may be deleted. It makes sg treat that volume with suspicion forever. Volumes that held data before markers existed weren't backfilled.

Refusals that protect you

RefusalMeansWhat to do
sg:volume-share-unsafeSharing a volume on one member wasn't approvedPass --force-volume-share <volume> if you mean it
sg:service-data-on-rootService data appears to be on an instance's root disk--confirm-root-data <instance> allows only a restart that keeps the root disk
sg:application-destroy-unsafeThe spec changes a volume's content type or shrinks itVolumes never shrink and never change type; restore the spec

Taking everything down

Destroying an application leaves the cluster and machines in place. To go further, see Form a cluster: taking a cluster apart.