Einzelne Datei aus einem Snapshot wiederherstellen
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Im folgenden Leitfaden erfahren Sie, wie Sie eine einzelne Datei aus einem Snapshot wiederherstellen.
Ähnlich wie beim Zurücksetzen einer Instanz ist die Verwendung eines Snapshots zum Wiederherstellen einer einzelnen Datei ein destruktiver Vorgang. Verwenden Sie diese Funktion mit Bedacht. Eine detaillierte Beschreibung der Snapshot-Einschränkungen finden Sie unter Einschränkungen der Snapshot-Funktion.
gcloud-CLI
Führen Sie den folgenden Befehl auf einer Client-VM aus, auf der die Instanz bereitgestellt ist, um eine Datei in einen vorherigen Zustand zurückzusetzen, der in einem Snapshot erfasst wurde:
Wenn Sie die Datei mount-point-directory/genomics-file.txt in dem Zustand wiederherstellen möchten, der im Snapshot snap2 beibehalten wird, führen Sie Folgendes aus:
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-03 (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)"]]