This guide shows you how to create a snapshot to preserve the state of your
Filestore data. To learn more about snapshots, see
[Snapshots](https://docs.cloud.google.com/filestore/docs/snapshots.md.txt).

## Create a snapshot

You can create a snapshot of an instance using one of the following methods:

### Google Cloud console

1. In the Google Cloud console, go to the Filestore instances
   page.

   [Go to the Filestore instances page](https://console.cloud.google.com/filestore/instances)
2. Click the instance that you want to create a snapshot of.

3. Click the **Snapshots** tab and then click **Create snapshot**.

4. For **Snapshot ID**, enter a name for the snapshot. The file share name and
   snapshot ID can have a combined length of up to 77 characters.

5. **Optional**: Add a description or labels to the snapshot.

6. Click **Create**.

### gcloud CLI

To create a snapshot of an instance, run the [`instances snapshots create`](https://docs.cloud.google.com/sdk/gcloud/reference/filestore/instances/snapshots/create)
command. The `--description` and `--labels` flags are added as optional
arguments:

```bash
gcloud filestore instances snapshots create SNAPSHOT_ID \
    --instance=INSTANCE_ID \
    --instance-location=LOCATION \
    --description="DESCRIPTION" \
    --labels=KEY=VALUE
```

Replace the following:

- <var translate="no">SNAPSHOT_ID</var> with the name that you want to give the snapshot. The file share name and snapshot ID can have a combined length of up to 77 characters. For example, `my-snapshot-1`.
- <var translate="no">INSTANCE_ID</var> with the name of the instance from which you want to create a snapshot. For example, `my-instance-1`.
- <var translate="no">LOCATION</var> with the [zone or region](https://docs.cloud.google.com/filestore/docs/regions.md.txt#supported_regions) of the instance. For example, `us-east1-b` or `us-central1`, respectively. Note that your instance's [service tier](https://docs.cloud.google.com/filestore/docs/service-tiers.md.txt#overview) determines whether a zone or region is a valid argument.
- <var translate="no">DESCRIPTION</var> with a description of the snapshot.
- <var translate="no">KEY=VALUE,...</var> with one or more `KEY=VALUE` pairs that you want to include.

#### Example

The following command creates a snapshot of the instance `nfs-server`, which
is located in `us-central1`. The snapshot is named `nfs-server-snapshot`.

```bash
gcloud filestore instances snapshots create nfs-server-snapshot \
    --instance=nfs-server \
    --instance-location=us-central1 \
```

## List, view, update, and delete snapshots

You can list, view, update, and delete snapshots.

### Google Cloud console

To manage your snapshots in the Google Cloud console:

1. Go to the Filestore instances page.

   [Go to the Filestore instances page](https://console.cloud.google.com/filestore/instances)
2. Click the instance ID of the instance that you want to view snapshots
   of.

3. Click the **Snapshots** tab.

From the **Snapshots** tab:

- To see details about a snapshot, click its snapshot ID.
- To edit a snapshot, click **Edit** in the snapshots details page.
- To delete a snapshot:

1. Click the snapshot ID of the snapshot that you want to delete.
2. Click **Delete**.
3. When prompted, type the snapshot ID.
4. Click **Delete**.

### gcloud CLI

### List all snapshots in your current project

To view a list of snapshots for an instance, run the [`instances snapshots list`](https://docs.cloud.google.com/sdk/gcloud/reference/filestore/instances/snapshots/list)
command:

```bash
gcloud filestore instances snapshots list \
    --instance=INSTANCE_ID \
    --instance-location=LOCATION
```

Replace the following:

- <var translate="no">INSTANCE_ID</var> with the name of the instance from which you want to create a list of snapshots. For example, `my-instance-1`.
- <var translate="no">LOCATION</var> with the [zone or region](https://docs.cloud.google.com/filestore/docs/regions.md.txt#supported_regions) of the instance. For example, `us-east1-b` or `us-central1`, respectively. Note that your instance's [service tier](https://docs.cloud.google.com/filestore/docs/service-tiers.md.txt#overview) determines whether a zone or region is a valid argument.

### View information about a snapshot

To view information about a snapshot, run the [`instances snapshots describe`](https://docs.cloud.google.com/sdk/gcloud/reference/filestore/instances/snapshots/describe)
command:

```bash
gcloud filestore instances snapshots describe SNAPSHOT_ID \
    --instance=INSTANCE_ID \
    --instance-location=LOCATION
```

Replace the following:

- <var translate="no">SNAPSHOT_ID</var> with the name that you want to give the snapshot. For example, `my-snapshot-1`.
- <var translate="no">INSTANCE_ID</var> with the name of the instance from which the snapshot was created. For example, `my-instance-1`.
- <var translate="no">LOCATION</var> with the [zone or region](https://docs.cloud.google.com/filestore/docs/regions.md.txt#supported_regions) of the instance from which the snapshot was created. For example, `us-east1-b` or `us-central1`, respectively. Note that your instance's [service tier](https://docs.cloud.google.com/filestore/docs/service-tiers.md.txt#overview) determines whether a zone or region is a valid argument.

### Update a snapshot

To update a snapshot, run the [`instances snapshots update`](https://docs.cloud.google.com/sdk/gcloud/reference/filestore/instances/snapshots/update)
command. The `--description` and `--update-labels` flags are added as optional
arguments:

```bash
gcloud filestore instances snapshots update SNAPSHOT_ID \
    --instance=INSTANCE_ID \
    --instance-location=LOCATION \
    --description="NEW-DESCRIPTION" \
    --update-labels=KEY1=VALUE1,KEY2=VALUE2...
```

Replace the following:

- <var translate="no">SNAPSHOT_ID</var> with the name that you want to give the snapshot. For example, `my-snapshot-1`.
- <var translate="no">INSTANCE_ID</var> with the name of the instance from which the snapshot was created. For example, `my-instance-1`.
- <var translate="no">LOCATION</var> with the [zone or region](https://docs.cloud.google.com/filestore/docs/regions.md.txt#supported_regions) of the instance from which the snapshot was created. For example, `us-east1-b` or `us-central1`, respectively. Note that your instance's [service tier](https://docs.cloud.google.com/filestore/docs/service-tiers.md.txt#overview) determines whether a zone or region is a valid argument.
- <var translate="no">NEW-DESCRIPTION</var> with a new description of the snapshot.
- <var translate="no">KEY1=VALUE1,...</var> with one or more `KEY=VALUE` pairs that you want to update. If a label exists, its value is updated, otherwise a new label is created.

### Delete a snapshot

Snapshot deletion is a long running operation that can take multiple hours to
complete, depending the number of files involved.

To delete a snapshot, run the [`instances snapshots delete`](https://docs.cloud.google.com/sdk/gcloud/reference/filestore/instances/snapshots/delete)
command:

```bash
gcloud filestore instances snapshots delete SNAPSHOT_ID \
    --instance=INSTANCE_ID \
    --instance-location=LOCATION \
```

Replace the following:

- <var translate="no">SNAPSHOT_ID</var> with the name that you want to give the snapshot. For example, `my-snapshot-1`.
- <var translate="no">INSTANCE_ID</var> with the name of the instance from which the snapshot was created. For example, `my-instance-1`.
- <var translate="no">LOCATION</var> with the [zone or region](https://docs.cloud.google.com/filestore/docs/regions.md.txt#supported_regions) of the instance from which the snapshot was created. For example, `us-east1-b` or `us-central1`, respectively. Note that your instance's [service tier](https://docs.cloud.google.com/filestore/docs/service-tiers.md.txt#overview) determines whether a zone or region is a valid argument.

## Restore data

You can restore individual files from a snapshot or revert the entire file share
to a prior snapshot state.

For more information, see [Restore a file from a snapshot](https://docs.cloud.google.com/filestore/docs/restore-file.md.txt)
and [Revert an instance to a prior snapshot state](https://docs.cloud.google.com/filestore/docs/revert-snapshot.md.txt).

## Monitoring

You can monitor an instance's snapshot capacity using Metrics Explorer. For more
information, see [Create charts with Metrics Explorer](https://docs.cloud.google.com/monitoring/charts/metrics-explorer.md.txt).

## What's next

- [Snapshots overview](https://docs.cloud.google.com/filestore/docs/snapshots.md.txt)
- [Restore a file from a snapshot](https://docs.cloud.google.com/filestore/docs/restore-file.md.txt)
- [Revert an instance to a prior snapshot state](https://docs.cloud.google.com/filestore/docs/revert-snapshot.md.txt)
- [Schedule Filestore enterprise snapshots](https://docs.cloud.google.com/filestore/docs/schedule-filestore-enterprise-snapshots.md.txt)
- [Backups overview](https://docs.cloud.google.com/filestore/docs/backups.md.txt)