Restore an individual file from a snapshot
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:
sudo cp -pa MOUNT-POINT-DIRECTORY/.snapshot/SNAPSHOT_ID/FILE MOUNT-POINT-DIRECTORY
Example
If you want to restore file mount-point-directory/genomics-file.txt to the state preserved
in snapshot snap2, run:
sudo cp -pa mount-point-directory/.snapshot/snap2/genomics-file.txt mount-point-directory/
What's next
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-10-13 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-10-13 UTC."],[],[]]