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