This page shows you how to back up data for disaster recovery usingFilestore backups. To learn more about backups, common use cases,and best practices, see Backups.
Supported tiers
The following table shows the Filestore service tiersthat support backups, encryption, and related restoreoperations:
Tier | Backups support | restore tonew instance | restore toexisting instance | restore tosource instance | CMEK support |
---|---|---|---|---|---|
Basic HDD | Yes | Yes | Yes | Yes | No |
Basic SSD | Yes | Yes | Yes | Yes | No |
Zonal | Yes | Yes | No | No | Yes |
Regional | Yes | Yes | No | No | Yes |
Enterprise | Yes | Yes | No | No | Yes |
Before you begin
Install gcloud.
Update gcloud components:
gcloud components update
Ensure that the account you are using has either the Cloud Filestore Editorrole, or the Project Owner or Project Editor basic role. For more informationabout roles and permissions for Filestore, seeAccess Control,IAM permissions, orAbout supported protocols.
Filestore backups don't include file locksand certain instance-specific information.The following table shows what information backups preserve and what informationthey don't:
Preserved | Not preserved |
---|---|
Instance ID | Description |
Tier of the source instance | Location |
Capacity | Network |
File share name | IP address |
Creation time | |
IP-based access controls | |
File locks | |
Lock state | |
Snapshots |
Backup chains and encryption
A backup chain is a collection ofbackups that reference the same source instance. Even if stored in a regionseparate from the source, a backup chain is collectively located in its ownbucket and region, and, if applicable, each backup in the chain is encryptedusing the same CMEK. All service tiers support multiple backup chains.
When creating a backup chain encrypted with CMEK, consider the followinglimitations:
CMEK support is not available for basic HDD and basic SSD backups.
A single CMEK is applied to the bucket where the backup chain is stored andcannot be combined or replaced.
For more information see Customer-managed encryption keysand Backups.
Create a backup
You can create a backup of a file share using one of the following methods:
Console
- Go to the Filestore instances page
- Click the Filestore instance that you want to create a backup of.
- Click the Backups tab.
- Click Create backup.
- For Backup ID, type a name for the backup.
- For Region, select the Google Cloud region where you want thebackup to be located.
- Optional: Add a description.
- Optional: Click Add label to add labels to the backup.
- Click Create.
gcloud
Run the following gcloud filestore backups createcommand in a terminal window on your local machine. The --kms-key
flag isoptional:
gcloud filestore backups create BACKUP-NAME \ --instance=INSTANCE-NAME \ --file-share=FILE-SHARE-NAME \ --instance-zone=ZONE \ --region=BACKUP-LOCATION \ --kms-key=projects/KMS-PROJECT/locations/KMS-LOCATION/keyRings/KEYRING/cryptoKeys/CRYPTO-KEY
where:
- BACKUP-NAME is the name you want to give the backup.
- INSTANCE-NAME is the name of the Filestore instance to back up.
- FILE-SHARE-NAME is the name of the file share on the Filestore instance.
- ZONE is the zone where the Filestore instance is located.
- BACKUP-LOCATION is the region where the backup will be stored. Ifa region is not indicated, the backup is created in the same region as theFilestore instance.
- KMS-PROJECT is the project name where the KMS key resource is stored.
- KMS-LOCATION is the region of the KMS key resource.
- KEYRING is the name of the key ring.
- CRYPTO-KEY is the KMS key resource.
Example
The following command creates a backup of file share vol1
on the Filestoreinstance nfs-server
, which is located in zone us-central1-c
. The backup isnamed mybackup
, is located in region asia-east2
, and has an associatedencryption key that will encrypt the instance when restored:
gcloud filestore backups create mybackup \ --instance=nfs-server \ --file-share=vol1 \ --instance-zone=us-central1-c \ --region=asia-east2 \ --kms-key=projects/purple-project/locations/us-central1/keyRings/filestore-keyring/cryptoKeys/filestore-key
List, view, update, and delete backups
Filestore backups can be listed, viewed, updated, and deleted.
Console
To view a list of all backups in your current project:
Go to the Filestore backups page
To see details about a backup, click the backup ID.
To delete a backup:
- Click the backup ID of the backup you want to delete.
- Click Delete.
- When prompted, type the backup ID.
- Click Delete.
gcloud
List all backups in your current project
To view a list of backups for your current project, run the backups listcommand:
gcloud filestore backups list
View information about a backup
To view information about a backup, run the backups describecommand:
gcloud filestore backups describe BACKUP-NAME \ --region=BACKUP-LOCATION
Where:
- BACKUP-NAME is the name of the backup whose information you want to view.
- BACKUP-LOCATION is the region where the backup is stored.
Update a backup
To update a backup, run the backups updatecommand:
gcloud filestore backups update BACKUP-NAME \ --region=BACKUP-LOCATION \ --description="NEW-DESCRIPTION" \ --update-labels=KEY=VALUE,...
Where:
- BACKUP-NAME is the name of the backup whose information you want to view.
- BACKUP-LOCATION is the region where the backup is stored. The region cannot be changed.
- NEW-DESCRIPTION is the description of the backup.
- KEY=VALUE,... is a list of
KEY=VALUE
pairs you want to update. If alabel exists, its value is updated, otherwise a new label is created.
Delete a backup
To delete a backup, run the backups deletecommand:
gcloud filestore backups delete BACKUP-NAME \ --region=BACKUP-LOCATION
Where:
- BACKUP-NAME is the name of the backup whose information you want to view.
- BACKUP-LOCATION is the region where the backup is stored.
Restore a file share
Before initiating a restore operation, we recommend pausing applications andunmounting from the file system to reduce the risk of application errors. Youmust then remount the file share after it is restored from a backup. Alloutstanding file locks are revoked upon successful restoration. Duringrestoration, client READ
and WRITE
operations are paused.
Limitations
Basic-tier backups can be restored to the source, a new instance, or to anexisting instance.
If you want to restore a backup of a zonal, regional,or enterprise instance, you must create a new instance.
When creating a new instance to complete a backup
restore
operation, the newinstance must match the source instance's service tier and capacity range. Forexample, if the source was created using the zonal service tier with lowercapacity range, the new instance must use the same service tier and capacityrange.When restoring a backup, the new instance must use the same protocolas the source instance.
Before you begin
When restoring a backup to an existing instance, if the backup and the instanceuse separate customer-managed encryption keys (CMEKs),you'll need to grant access to the backup's key from the target instance'sproject-level service account.
gcloud
Ensure you have the proper permissions such as theroles/cloudkms.adminrole to run the following command:
gcloud projects add-iam-policy-binding KMS_PROJECT_NUMBER \ --member serviceAccount:service-TARGET_INSTANCE_PROJECT_NUMBER@cloud-filer.iam.gserviceaccount.com \ --role roles/cloudkms.cryptoKeyEncrypterDecrypter
where:
- KMS_PROJECT_NUMBER is the project number where the key islocated.
- TARGET_INSTANCE_PROJECT_NUMBER is the project number for theinstance you want associated with the key.
For gcloud
flag details, see the gcloud projects add-iam-policy-bindingpage.
Restore to the source or an existing instance
You can restore a basic tier backup to the source instance or to a fileshare of an existing Filestore instance.
When restoring a backup to an existing Filestore instance, thecapacity of the target instance must be greater than or equal to that of theoriginal instance from which the backup was created. If the original instancehas a greater capacity, you must first increase the target instance's capacitybefore attempting the restore operation.
If a backup restore to a basic HDD or basic SSD instance fails, the file sharestate remains unchanged.
If, once the operation begins, a backup restore to a zonal, regional, orenterprise instance fails, the file system resets to an empty state. Users areresponsible for retrying the operation.
Console
- Go to the Filestore instances page
- Click the instance ID of the instance you want to restore a backup from.
- Click the Backups tab.
- Locate the backup you want to restore from and click (...)More actions.
- Click Restore backup.
- Choose a target instance to restore:
- If restoring the source instance, click Source instance.
- If restoring to another existing instance, click Other existing instance.
- Click Select instance.
- Select the target instance where you want the restored backup toreside and click Select.
- Click Restore and a confirmation dialog appears.
- Click the acknowledgement checkbox.
- Enter the name of the backup in the input field and click Restore.
gcloud
To restore a Filestore file share to an existing instance, run theinstances restorecommand:
gcloud filestore instances restore INSTANCE-NAME \ --source-backup=BACKUP-NAME \ --source-backup-region=BACKUP-LOCATION \ --file-share=FILE-SHARE-NAME \ --zone=INSTANCE-LOCATION
Where:
- INSTANCE-NAME is the name of the existing Filestore instance to restore the file share to.
- BACKUP-NAME is the name of the backup to restore from.
- BACKUP-LOCATION is the region where the backup is located.
- FILE-SHARE-NAME is the name of the file share to restore to.
- INSTANCE-LOCATION is the zone that the Filestore instance is located.
Example
The following command restores mybackup
, which is located in regionasia-east2
, to file share vol1
on Filestore instancemyinstance
, which is located in zone us-central1-c
:
gcloud filestore instances restore myinstance \ --source-backup=mybackup \ --source-backup-region=asia-east2 \ --file-share=vol1 \ --zone=us-central1-c
Restore to a new instance
When a backup is restored to a new Filestore instance, the capacity ofthe new file share must be greater than or equal to the capacity of the backup.For zonal, regional, and enterprise tier instances, the capacity of the new fileshare must be greater than or equal to the capacity of the source share.
You must use the same service tier as thesource backup.
Console
In the Google Cloud console, go to the Filestore instances page.
Go to the Filestore instances page
Click Backups.
Click the name of the backup you want to restore from.
Click Restore.
Click New instance.
Configure the new instance by following the instructions on the page. For details, see Creating instances.
Click Restore.
gcloud
To restore a Filestore file share to a new instance, run theinstances create command:
gcloud filestore instances create INSTANCE-NAME \ --zone=ZONE \ --tier=TIER \ --file-share=name=FILE-SHARE-NAME,capacity=FILE-SHARE-CAPACITY,source-backup=SOURCE-BACKUP-NAME,source-backup-region=SOURCE-BACKUP-LOCATION \ --network=name=VPC-NETWORK,reserved-ip-range=RESERVED-IP-ADDRESS
Where:
- INSTANCE-NAME is the name you want to give to the new Filestore instance.
- ZONE is the zone where the Filestore instance resides.
- TIER is the service tier you want to use. This should be the sameas the source backup.
- FILE-SHARE-NAME is the name you specify for the NFS file share that is served from the instance.
- FILE-SHARE-CAPACITY is the capacity you want for the file share.
- SOURCE-BACKUP-NAME is the name of the backup to restore from.
- SOURCE-BACKUP-LOCATION is the region where the backup is located.
- VPC-NETWORK is the name of the VPC network you want the instance to use.
- RESERVED-IP-ADDRESS is the IP address range for the Filestore instance.
For gcloud
flag details, see Creating instances.
Example
The following command creates a new Filestore instance myinstance-restored
located in zone us-central1-c
on network default. Backup mybackup
located in region asia-east2
is restored on file share vol1
ofmyinstance-restored
with a 2TiB
capacity:
gcloud filestore instances create myinstance-restored \ --zone=us-central1-c \ --tier=zonal \ --network=name=default \ --file-share=name=vol1,capacity=2TiB,source-backup=mybackup,source-backup-region=asia-east2
What's next
- Learn how to schedule backups using Cloud Scheduler.
- Learn more about backups, common use cases, and best practices.
- Learn about backups pricing.
- Learn how to set up alerts forlow disk space andlow backups quota.
- Learn about backups-related known issues.