| --- |
| page_title: Recover state from backup |
| description: >- |
| Learn how to restore state backups and override Terraform state protections to fix state errors with the Terraform CLI. |
| --- |
| |
| # Recover state from backup overview |
| |
| This topic provides overview information about recovering Terraform state from a backup after a disaster, such as an accident when performing |
| other state manipulation actions. |
| |
| ## Workflow |
| |
| 1. **Unlock Terraform**: You may need to unlock Terraform when a `terraform apply` or other process unexpectedly terminates before Terraform can release its lock on the state backend. Unlocking Terraform overrides protectionsthat prevent two processes from modifying state at the same time. We do not recommend unlocking until you determine what caused the lock to get stuck. |
| |
| Refer to the [`terraform force-unlock` command](/terraform/cli/commands/force-unlock) documentation for additional information. |
| |
| 1. **Read state data**: Run the [`terraform state pull` command](/terraform/cli/commands/state/pull) to read the state files from the configured backend. |
| 1. **Write state data**: Run the [`terraform state push` command](/terraform/cli/commands/state/push) to write state files to the configured backend. |