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 which Filestore service tiers support snapshots and the revert instance operation:

Tier Snapshot support Revert support
Basic HDD No No
Basic SSD No No
Zonal with a lower capacity range Yes Yes (Preview)
Zonal with a higher capacity range (previously high scale SSD) Yes Yes (Preview)
Enterprise Yes Yes (Preview)

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

  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 command. The --description and --labels flags are added as optional arguments:

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

Replace the following:

  • SNAPSHOT_ID 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.
  • INSTANCE_ID with the name of the instance from which you want to create a snapshot. For example, my-instance-1.
  • LOCATION with the zone or region of the instance. For example, us-east1-b or us-central1, respectively. Note that your instance's service tier determines whether a zone or region is a valid argument.
  • DESCRIPTION with a description of the snapshot.
  • KEY=VALUE,... with one or more KEY=VALUE pairs that you want to include.

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 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

  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 CLI

List all snapshots in your current project

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

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

Replace the following:

  • INSTANCE_ID with the name of the instance from which you want to create a list of snapshots. For example, my-instance-1.
  • LOCATION with the zone or region of the instance. For example, us-east1-b or us-central1, respectively. Note that your instance's service tier 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 command:

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

Replace the following:

  • SNAPSHOT_ID with the name that you want to give the snapshot. For example, my-snapshot-1.
  • INSTANCE_ID with the name of the instance from which the snapshot was created. For example, my-instance-1.
  • LOCATION with the zone or region 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 determines whether a zone or region is a valid argument.

Update a snapshot

To update a snapshot, run the instances snapshots update command. The --description and --update-labels flags are added as optional arguments:

gcloud filestore instances snapshots update SNAPSHOT_ID \
    --instance=INSTANCE_ID \
    --instance-location=LOCATION \
    --description="NEW-DESCRIPTION" \
    --update-labels=KEY=VALUE,...

Replace the following:

  • SNAPSHOT_ID with the name that you want to give the snapshot. For example, my-snapshot-1.
  • INSTANCE_ID with the name of the instance from which the snapshot was created. For example, my-instance-1.
  • LOCATION with the zone or region 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 determines whether a zone or region is a valid argument.
  • NEW-DESCRIPTION with a new description of the snapshot.
  • KEY=VALUE,... 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 command:

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

Replace the following:

  • SNAPSHOT_ID with the name that you want to give the snapshot. For example, my-snapshot-1.
  • INSTANCE_ID with the name of the instance from which the snapshot was created. For example, my-instance-1.
  • LOCATION with the zone or region 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 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 snapshot state.

Restore individual files

gcloud CLI

To restore a file to a previous state that's captured in a snapshot, run the following command from a client VM that has the instance mounted:

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/

Revert file share to a snapshot state

Reverting an instance to a snapshot state is available as a Preview feature for the following service tiers only:

  • zonal
  • enterprise

A revert operation may take several hours to complete, depending on the number of files involved. You must wait for the revert operation to complete before starting another revert operation.

Only instances with a single share can revert to a snapshot state. The revert snapshot feature cannot be combined with Filestore multishares for GKE. For more information, see Snapshots or the gcloud beta filestore instances revert page.

gcloud CLI

To revert a file share to the state captured in a snapshot:

  1. Unmount the file share from clients:

    sudo umount mount-point-directory
    
  2. Revert the file share to a snapshot state using the instances revert command:

    gcloud beta filestore instances revert INSTANCE_ID \
        --target-snapshot=SNAPSHOT_ID \
        --location=LOCATION
    

    Replace the following:

    • INSTANCE_ID with the name of the instance where you want to apply the revert operation. For example, my-instance-1.
    • SNAPSHOT_ID with the name of the snapshot you want to use for the revert operation. For example, my-snapshot-3.
    • LOCATION with the location of the instance. For example, us-central1.

You must wait for the revert operation to complete before you can start another revert operation for the instance. The instance can be mounted on clients once it has changed from the REVERTING state to the READY state, which can take a few minutes. However, the space reclamation process can take up to several hours to complete. During this process, the reclaimed space becomes available gradually until the long running operation finishes and all reclaimed space is available.

Monitoring

You can monitor an instance's snapshot capacity using Metrics Explorer. For more information, see Create charts with Metrics Explorer.

What's next