Preserve the state of your data with snapshots

This page describes how to preserve the state of your Filestore data using snapshots. To learn more about snapshots, see Snapshots.

Supported tiers

The following table shows the Filestore tiers that support snapshots:

Tier Snapshots support
Basic HDD No
Basic SSD No
High Scale SSD No
Enterprise Yes

Create a snapshot

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

Cloud Console

  1. In the Cloud Console, go to the Filestore instances page.

    Go to the Filestore instances page

  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, type a name for the snapshot. The file share name and snapshot ID combined cannot exceed 77 characters.

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

  6. Click Create.

gcloud tool

To create a snapshot of an instance, run:

gcloud beta filestore instances snapshots create SNAPSHOT_ID \
    --instance=INSTANCE_ID \
    --instance-region=REGION \
    [--description=DESCRIPTION] \
    [--labels=KEY=LABEL]

Replace the following:

  • SNAPSHOT_ID with the name that you want to give the snapshot. The file share name and snapshot ID combined cannot exceed 77 characters.
  • INSTANCE_ID with the name of the instance that you want to create a snapshot for.
  • REGION with the region of the instance.

Example

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

gcloud beta filestore instances snapshots create nfs-server-snapshot \
    --instance=nfs-server \
    --instance-region=us-central1 \

List, view, update, and delete snapshots

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

Cloud Console

To manage your snapshots in the Cloud Console:

  1. Go to the Filestore instances page.

    Go to the Filestore instances page

  2. Click on 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 tool

List all snapshots in your current project

To view a list of snapshots for an instance, run:

gcloud beta filestore instances snapshots list \
    --instance=INSTANCE_ID \
    --instance-region=REGION

Replace the following:

  • INSTANCE_ID with the name of the instance that you want to list snapshots of.
  • REGION with the region of the instance.

View information about a snapshot

To view information about a snapshot, run:

gcloud beta filestore instances snapshots describe SNAPSHOT_ID \
    --instance=INSTANCE_ID \
    --instance-region=REGION

Replace the following:

  • SNAPSHOT_ID with the name that you want to give the snapshot.
  • INSTANCE_ID with the name of the instance which the snapshot belongs to.
  • REGION with the region of the instance which the snapshot belongs to.

Update a snapshot

To update a snapshot, run:

gcloud beta filestore instances snapshots update SNAPSHOT_ID \
    --instance=INSTANCE_ID \
    --instance-region=REGION \
    [--description="NEW-DESCRIPTION"] \
    [--update-labels=KEY=VALUE,...]

Replace the following:

  • SNAPSHOT_ID with the name that you want to give the snapshot.
  • INSTANCE_ID with the name of the instance which the snapshot belongs to.
  • REGION with the region of the instance which the snapshot belongs to.
  • NEW-DESCRIPTION with a new description of the snapshot.
  • KEY=VALUE,... with a list of 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 hours to complete.

To delete a snapshot, run:

gcloud beta filestore instances snapshots delete SNAPSHOT_ID \
    --instance=INSTANCE_ID \
    --instance-region=REGION \

Replace the following:

  • SNAPSHOT_ID with the name that you want to give the snapshot.
  • INSTANCE_ID with the name of the instance which the snapshot belongs to.
  • REGION with the region of the instance which the snapshot belongs to.

Restoring data

If you want to restore a file to a previous state that's captured in a snapshot, run:

sudo cp -pa DIR/.snapshot/SNAPSHOT_ID/FILE DIR

Example

If you want to restore file foo/bar.txt to the state preserved in snapshot snap2, run:

sudo cp -pa foo/.snapshot/snap2/bar.txt foo/

What's next