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:

sudocp-paMOUNT-POINT-DIRECTORY/.snapshot/SNAPSHOT_ID/FILEMOUNT-POINT-DIRECTORY

Example

If you want to restore file mount-point-directory/genomics-file.txt to the state preserved in snapshot snap2, run:

sudocp-pamount-point-directory/.snapshot/snap2/genomics-file.txtmount-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 2025年10月29日 UTC.