Stay organized with collections
Save and categorize content based on your preferences.
The following guide shows how to restore an individual file from a snapshot.
Similar to reverting an instance,
using a snapshot to restore a single file is a destructive operation. Use this
feature carefully. For a detailed description of snapshot limitations,
see Snapshot feature limitations.
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:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThis guide demonstrates how to restore a single file from a snapshot using the \u003ccode\u003egcloud CLI\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eRestoring a file from a snapshot is a destructive operation, similar to reverting an instance.\u003c/p\u003e\n"],["\u003cp\u003eTo restore a file, use the \u003ccode\u003esudo cp -pa\u003c/code\u003e command on a client VM with the instance mounted, specifying the snapshot ID and file path.\u003c/p\u003e\n"],["\u003cp\u003eEnsure you are aware of the snapshot feature limitations before proceeding with file restoration.\u003c/p\u003e\n"]]],[],null,["# Restore an individual file from a snapshot\n\nThe following guide shows how to restore an individual file from a snapshot.\n\nSimilar to [reverting an instance](/sdk/gcloud/reference/filestore/instances/revert),\nusing a snapshot to restore a single file is a destructive operation. Use this\nfeature carefully. For a detailed description of snapshot limitations,\nsee [Snapshot feature limitations](/filestore/docs/snapshots#feature_limitations). \n\n### gcloud CLI\n\nTo restore a file to a previous state that's captured in a snapshot, run the\nfollowing command from a client VM that has the instance mounted: \n\n sudo cp -pa \u003cvar translate=\"no\"\u003eMOUNT-POINT-DIRECTORY\u003c/var\u003e/.snapshot/\u003cvar translate=\"no\"\u003eSNAPSHOT_ID\u003c/var\u003e/\u003cvar translate=\"no\"\u003eFILE\u003c/var\u003e \u003cvar translate=\"no\"\u003eMOUNT-POINT-DIRECTORY\u003c/var\u003e\n\n#### Example\n\nIf you want to restore file `mount-point-directory/genomics-file.txt` to the state preserved\nin snapshot `snap2`, run: \n\n sudo cp -pa mount-point-directory/.snapshot/snap2/genomics-file.txt mount-point-directory/\n\nWhat's next\n-----------\n\n- [Snapshots overview](/filestore/docs/snapshots)\n- [Revert an instance to a prior snapshot state](/filestore/docs/revert-snapshot)\n- [Schedule Filestore enterprise snapshots](/filestore/docs/schedule-filestore-enterprise-snapshots)\n- [Backups overview](/filestore/docs/backups)"]]